Improved syntax for functions

Added logging system for AST nodes as well.
This commit is contained in:
Pasha Bibko
2025-04-24 21:34:30 +01:00
parent 099e543e95
commit 321a7fea18
8 changed files with 74 additions and 27 deletions

View File

@@ -16,9 +16,6 @@ namespace LX
llvm::Module module;
llvm::IRBuilder<> builder;
};
// Function to turn a AST node into string //
std::string ToString(std::unique_ptr<AST::Node>& node);
}
namespace LX::AST
@@ -33,6 +30,9 @@ namespace LX::AST
// Function for generating LLVN IR (Intermediate representation) //
llvm::Value* GenIR(InfoLLVM& LLVM) override;
// Function to log the node to a file //
void Log(std::ofstream* log, unsigned depth) override;
private:
// The number it stores //
// Yes the number is stored as a string, It's horrible I know //
@@ -49,6 +49,9 @@ namespace LX::AST
// Function for generating LLVN IR (Intermediate representation) //
llvm::Value* GenIR(InfoLLVM& LLVM) override;
// Function to log the node to a file //
void Log(std::ofstream* log, unsigned depth) override;
private:
// The sides of the operation //
// Unary operations are handled by a different class //
@@ -68,6 +71,9 @@ namespace LX::AST
// Function for generating LLVN IR (Intermediate representation) //
llvm::Value* GenIR(InfoLLVM& LLVM) override;
// Function to log the node to a file //
void Log(std::ofstream* log, unsigned depth) override;
private:
// What it is returning (can be null) //
std::unique_ptr<Node> m_Val;