Advanced types¶
Here are some advanced types used to build abstract syntax tree.
- variable:
This module contains all about variables in pseudocode.
-
class
pseudo.type.variable.Assignment(target: pseudo.type.variable.Variable, value: pseudo.type.base.Value, object_class=<class 'pseudo.runtime.MemoryObject'>, line: str = '')¶ Node for representing assignments.
-
- target Target variable.
-
- value Value to assign.
-
-
class
pseudo.type.variable.Increment(key: str, line: str = '')¶ Representing incrementation of iterator.
-
- key str, Key of iterator.
-
- line str, Representation of operation in pseudocode.
-
-
class
pseudo.type.variable.Variable(value, indices=[])¶ Node for representing variables.
-
- value Name of the variable.
-
- indices List of indices.
-
-
class
- conditional:
This module contains everything about conditional statements in pseudocode.
-
class
pseudo.type.conditional.Condition(condition, true, false=None, line='')¶ Node for representing conditional expressions (if).
-
- condition Condition to check
-
- true List to evaluate if condition is true
-
- false List to evaluate if condition is false (optional)
-
- line String of pseudocode representation
-
-
pseudo.type.conditional.read_if(lexer, indent_level: int = 0) → pseudo.type.conditional.Condition¶ Read if statement from stream. This function expect stream cursor be after if keyword:
'if condition then' ^
Parameters: - lexer (-) – Lexer object used to apply lexing rules.
- indent_level (-) – int, Indicates level of indentation passed to children.
-
class
- operation:
This module contains classes for representing operations in AST.
-
class
pseudo.type.operation.Operation(operator, left, right)¶ Operation node.
-
class
pseudo.type.operation.Operator(value, line='')¶ Opartor class for representing mathematical operator.
-
pseudo.type.operation.is_operator(c) → bool¶ Checks if given char is an allowed operator.
-
pseudo.type.operation.read_operator(stream)¶ Return operator from input stream.
Parameters: stream (-) – Input stream
-
class