diff options
author | Santo Cariotti <santo@dcariotti.me> | 2024-06-30 13:45:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-30 13:45:57 +0200 |
commit | 8aa8b5834953cab15c0687608f4fafea2e6c61be (patch) | |
tree | 1835ae7c789136b4a6c44c12efd4247a0b96d893 /src/ast/nodes/Node.java | |
parent | 7125bb27fedaafd5a56b5122e4251b182448ddac (diff) | |
parent | 06d7c8dee25c065b1a569337f34d3cd5e892a31d (diff) |
Merge pull request #10 from boozec/check-semantics
Co-Authored-By: geno <gabriele.genovese2@studio.unibo.it>
Co-Authored-By: L0P0P <grassoemanuele@live.com>
Diffstat (limited to 'src/ast/nodes/Node.java')
-rw-r--r-- | src/ast/nodes/Node.java | 85 |
1 files changed, 79 insertions, 6 deletions
diff --git a/src/ast/nodes/Node.java b/src/ast/nodes/Node.java index 949531e..9fb58b8 100644 --- a/src/ast/nodes/Node.java +++ b/src/ast/nodes/Node.java @@ -1,19 +1,92 @@ package ast.nodes; +import ast.types.*; import java.util.ArrayList; - import semanticanalysis.SemanticError; import semanticanalysis.SymbolTable; -import ast.types.*; /** * Base interface for a Node. */ public interface Node { + + static final String[] bif = { + "abs", + "aiter", + "all", + "anext", + "any", + "ascii", + "bin", + "bool", + "breakpoint", + "bytearray", + "bytes", + "callable", + "chr", + "classmethod", + "compile", + "complex", + "delattr", + "dict", + "dir", + "divmod", + "enumerate", + "eval", + "exec", + "exit", + "filter", + "float", + "format", + "frozenset", + "getattr", + "globals", + "hasattr", + "hash", + "help", + "hex", + "id", + "input", + "int", + "isinstance", + "issubclass", + "iter", + "len", + "list", + "locals", + "map", + "max", + "memoryview", + "min", + "next", + "object", + "oct", + "open", + "ord", + "pow", + "print", + "property", + "range", + "repr", + "reversed", + "round", + "set", + "setattr", + "slice", + "sorted", + "staticmethod", + "str", + "sum", + "super", + "tuple", + "type", + "vars", + "zip", + "__import__"}; + /** * Checks semantics for a given node for a SymbolTable ST and a level of - * nesting. - * Returns a list of `SemanticError`. + * nesting. Returns a list of `SemanticError`. */ ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting); @@ -29,8 +102,8 @@ public interface Node { String codeGeneration(); /** - * Returns a string for a given node with a prefix. - * It used when an AST wants to be visualized on screen. + * Returns a string for a given node with a prefix. It used when an AST + * wants to be visualized on screen. */ String toPrint(String prefix); } |