AST¶
AST classes and functions.
BinaryExprAST
¶
Bases: ExprAST
AST class for the binary operator.
Source code in src/arx/ast.py
131 132 133 134 135 136 137 138 139 140 141 142 |
|
__init__(loc, op, lhs, rhs)
¶
Initialize the BinaryExprAST instance.
Source code in src/arx/ast.py
134 135 136 137 138 139 140 141 142 |
|
BlockAST
¶
Bases: ExprAST
The AST tree.
Source code in src/arx/ast.py
70 71 72 73 74 75 76 77 78 |
|
__init__()
¶
Initialize the BlockAST instance.
Source code in src/arx/ast.py
75 76 77 78 |
|
CallExprAST
¶
Bases: ExprAST
AST class for function call.
Source code in src/arx/ast.py
145 146 147 148 149 150 151 152 153 154 155 |
|
__init__(loc, callee, args)
¶
Initialize the CallExprAST instance.
Source code in src/arx/ast.py
148 149 150 151 152 153 154 155 |
|
ExprAST
¶
AST main expression class.
Source code in src/arx/ast.py
58 59 60 61 62 63 64 65 66 67 |
|
__init__(loc=SourceLocation(0, 0))
¶
Initialize the ExprAST instance.
Source code in src/arx/ast.py
64 65 66 67 |
|
ExprKind
¶
Bases: Enum
The expression kind class used for downcasting.
Source code in src/arx/ast.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
FloatExprAST
¶
Bases: ExprAST
AST for the literal float number.
Source code in src/arx/ast.py
93 94 95 96 97 98 99 100 101 102 |
|
__init__(val)
¶
Initialize the FloatAST instance.
Source code in src/arx/ast.py
98 99 100 101 102 |
|
ForStmtAST
¶
Bases: ExprAST
AST class for For
statement.
Source code in src/arx/ast.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
__init__(var_name, start, end, step, body)
¶
Initialize the ForStmtAST instance.
Source code in src/arx/ast.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
FunctionAST
¶
Bases: ExprAST
AST class for function definition.
Source code in src/arx/ast.py
267 268 269 270 271 272 273 274 275 276 277 278 |
|
__init__(proto, body)
¶
Initialize the FunctionAST instance.
Source code in src/arx/ast.py
273 274 275 276 277 278 |
|
IfStmtAST
¶
Bases: ExprAST
AST class for if
statement.
Source code in src/arx/ast.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
__init__(loc, cond, then_, else_)
¶
Initialize the IfStmtAST instance.
Source code in src/arx/ast.py
165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
ModuleAST
¶
Bases: BlockAST
AST main expression class.
Source code in src/arx/ast.py
81 82 83 84 85 86 87 88 89 90 |
|
__init__(name)
¶
Initialize the ExprAST instance.
Source code in src/arx/ast.py
86 87 88 89 90 |
|
PrototypeAST
¶
Bases: ExprAST
AST class for function prototype declaration.
Source code in src/arx/ast.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
__init__(loc, name, type_name, args)
¶
Initialize the PrototypeAST instance.
Source code in src/arx/ast.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
get_name()
¶
Return the prototype name.
Source code in src/arx/ast.py
250 251 252 |
|
ReturnStmtAST
¶
Bases: ExprAST
AST class for function return
statement.
Source code in src/arx/ast.py
255 256 257 258 259 260 261 262 263 264 |
|
__init__(value)
¶
Initialize the ReturnStmtAST instance.
Source code in src/arx/ast.py
260 261 262 263 264 |
|
UnaryExprAST
¶
Bases: ExprAST
AST class for the unary operator.
Source code in src/arx/ast.py
120 121 122 123 124 125 126 127 128 |
|
__init__(op_code, operand)
¶
Initialize the UnaryExprAST instance.
Source code in src/arx/ast.py
123 124 125 126 127 128 |
|
VarExprAST
¶
Bases: ExprAST
AST class for variable declaration.
Source code in src/arx/ast.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
__init__(var_names, type_name, body)
¶
Initialize the VarExprAST instance.
Source code in src/arx/ast.py
214 215 216 217 218 219 220 221 222 223 224 225 |
|
VariableExprAST
¶
Bases: ExprAST
AST class for the variable usage.
Source code in src/arx/ast.py
105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
__init__(loc, name, type_name)
¶
Initialize the VariableExprAST instance.
Source code in src/arx/ast.py
108 109 110 111 112 113 |
|
get_name()
¶
Return the variable name.
Source code in src/arx/ast.py
115 116 117 |
|