2022-10-17 22:26:36 -03:00
|
|
|
#ifndef OBELISK_AST_EXPRESSION_AST_H
|
|
|
|
#define OBELISK_AST_EXPRESSION_AST_H
|
|
|
|
|
2022-11-21 21:24:44 -03:00
|
|
|
#include <llvm/IR/Constants.h>
|
|
|
|
|
2022-10-17 22:26:36 -03:00
|
|
|
namespace obelisk
|
|
|
|
{
|
2023-02-20 22:01:14 -03:00
|
|
|
/**
|
|
|
|
* @brief A generic AST expression which other expression will inherit from.
|
|
|
|
*
|
|
|
|
*/
|
2022-10-17 22:26:36 -03:00
|
|
|
class ExpressionAST
|
|
|
|
{
|
|
|
|
public:
|
2023-02-20 22:01:14 -03:00
|
|
|
/**
|
|
|
|
* @brief Destroy the ExpressionAST object.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
virtual ~ExpressionAST() = default;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Generate LLVM IR code based on the AST expression.
|
|
|
|
*
|
2023-02-20 22:05:57 -03:00
|
|
|
* @return llvm::Value* Returns the LLVM code value from the
|
|
|
|
* expression.
|
2023-02-20 22:01:14 -03:00
|
|
|
*/
|
2022-11-21 21:24:44 -03:00
|
|
|
virtual llvm::Value *codegen() = 0;
|
2022-10-17 22:26:36 -03:00
|
|
|
};
|
|
|
|
} // namespace obelisk
|
|
|
|
|
|
|
|
#endif
|