node library

Abstract Syntax Tree (AST) node definitions and LLVM IR generation for Balbismo.

This library defines the complete AST node hierarchy for the Balbismo programming language, along with LLVM Intermediate Representation (IR) code generation. Each AST node represents a construct in the Balbismo language and knows how to generate the corresponding LLVM IR code.

The AST nodes are organized into several categories:

  • Expressions: Literals, identifiers, binary/unary operations, function calls
  • Statements: Variable declarations, assignments, control flow (if/while)
  • Types: Type representations and casting operations
  • I/O Operations: Print and scanf statements

Key features of this AST implementation:

  • Type Safety: All nodes are strongly typed with compile-time type checking
  • LLVM IR Generation: Each node generates optimized LLVM IR code
  • Symbol Resolution: Integration with the symbol table for variable/function lookup
  • Error Handling: Comprehensive error checking and meaningful error messages
  • Memory Management: Proper stack allocation and pointer handling

The code generation process transforms high-level Balbismo constructs into low-level LLVM IR instructions that can be compiled to machine code by LLVM tools.

Classes

ArgumentList
Represents a list of function call arguments in Balbismo.
ArraySpecification
Represents an array size specification in Balbismo.
ArrayTypeNode
Represents an array type specification in Balbismo.
AssignmentNode
BinOp
Represents a mathematical binary operation in Balbismo.
BlockNode
Represents a block of statements in Balbismo.
BoolBinOp
Represents a boolean binary operation in Balbismo.
BoolUnOp
Represents a boolean unary operation in Balbismo.
DeclareNode
FloatVal
Represents a floating-point literal value in Balbismo.
FuncCall
Represents a function call expression in Balbismo.
FuncDec
Represents a function declaration in Balbismo.
FunctionList
Represents a collection of function declarations in Balbismo.
IdentifierNode
Represents a variable identifier reference in Balbismo.
IfNode
Represents an if-then-else conditional statement in Balbismo.
IndexedIdentifierNode
Represents an array element access using indexing in Balbismo.
IntVal
Represents an integer literal value in Balbismo.
Node<T, E>
Abstract base class for all AST nodes in the Balbismo compiler.
ParameterList
Represents a list of function parameters in Balbismo.
PrintNode
Represents a printf statement for output in Balbismo.
RelOp
Represents a relational comparison operation in Balbismo.
ReturnStatement
Represents a return statement in Balbismo.
ScanfNode
Represents a scanf statement for input in Balbismo.
StringLiteral
Represents a string literal constant in Balbismo.
TypeCast
Represents a type cast operation in Balbismo.
TypeNode
Represents a type specification in Balbismo.
UnOp
Represents a mathematical unary operation in Balbismo.
WhileNode
Represents a while loop statement in Balbismo.

Enums

BoolOperator
Enumeration of boolean operators for logical expressions in Balbismo.
MathOp
Enumeration of mathematical operators supported in Balbismo expressions.
RelOperator
Enumeration of relational operators for comparison expressions in Balbismo.

Functions

generateLLVMConstant(String variableName, String content) String
Generates an LLVM constant string definition from a Dart string.