base
¶
Define the public irx API.
Builder
¶
Builder()
Bases: ABC
ASTx Builder.
Source code in src/irx/builders/base.py
120 121 122 123 124 125 126 127 128 129 130 131 |
|
build
abstractmethod
¶
build(expr: AST, output_file: str) -> None
Transpile ASTx to LLVM-IR and build an executable file.
Source code in src/irx/builders/base.py
141 142 143 144 145 146 147 148 |
|
module
¶
module() -> Module
Create a new ASTx Module.
Source code in src/irx/builders/base.py
133 134 135 |
|
run
abstractmethod
¶
run() -> None
Run the generated executable.
Source code in src/irx/builders/base.py
150 151 152 153 |
|
BuilderVisitor
¶
Builder translator visitor.
translate
¶
translate(expr: AST) -> str
Translate an ASTx expression to string.
Example of how it could be implemented:
self.visit(expr)
return str(self.result)
Source code in src/irx/builders/base.py
19 20 21 22 23 24 25 26 27 28 |
|
visit
¶
visit(expr: VariableDeclaration) -> None
Translate an ASTx VariableDeclaration expression.
Source code in src/irx/builders/base.py
105 106 107 108 |
|