interpreter.ast package¶
Submodules¶
interpreter.ast.nodes module¶
- class interpreter.ast.nodes.Nodes¶
Bases:
object
“ A class representing the reserved values of the AST nodes.
- AND = 'and'¶
- AND_OP = '&'¶
- ASSIGN = '='¶
- AT = '@'¶
- AUG = 'aug'¶
- BOP = ['aug', 'or', '&', 'gr', 'ge', 'ls', 'le', 'eq', 'ne', '+', '-', '*', '/', '**']¶
- COMMA = ','¶
- COND = '->'¶
- DIVIDE = '/'¶
- DUMMY = 'dummy'¶
- EQ = 'eq'¶
- FALSE = 'false'¶
- FCN_FORM = 'function_form'¶
- GAMMA = 'gamma'¶
- GE = 'ge'¶
- GR = 'gr'¶
- LAMBDA = 'lambda'¶
- LE = 'le'¶
- LET = 'let'¶
- LS = 'ls'¶
- MINUS = '-'¶
- MULTIPLY = '*'¶
- NE = 'ne'¶
- NEG = 'neg'¶
- NIL = 'nil'¶
- NOT = 'not'¶
- OR = 'or'¶
- PARENS = '()'¶
- PLUS = '+'¶
- POWER = '**'¶
- REC = 'rec'¶
- TAU = 'tau'¶
- TRUE = 'true'¶
- TYPES = ['true', 'false', 'nil', 'dummy']¶
- UOP = ['neg', 'not']¶
- WHERE = 'where'¶
- WITHIN = 'within'¶
- YSTAR = '<Y*>'¶
interpreter.ast.standardize module¶
- class interpreter.ast.standardize.ASTStandardizer¶
Bases:
object
A class that standardizes an Abstract Syntax Tree (AST).
- NON_STANDARDIZE = ['neg', 'not', 'aug', 'or', '&', 'gr', 'ge', 'ls', 'le', 'eq', 'ne', '+', '-', '*', '/', '**', 'gamma', 'tau', '->', ',', 'true', 'false', 'dummy', 'nil', '=']¶
- static check_to_standardize(node: BinaryTreeNode)¶
Module contents¶
- class interpreter.ast.ASTNode(value, left=None, right=None)¶
Bases:
BinaryTreeNode
A class representing a node in an Abstract Syntax Tree (AST).
The ASTNode class uses the left child right sibling representation to store the tree structure. Each node contains a reference to its node value, left child, and right sibling.