nand2tetris/compiler/keywords.py

49 lines
861 B
Python
Raw Normal View History

from enum import Enum,Flag,auto
class Keyword(Flag):
CLASS = auto()
METHOD = auto()
FUNCTION = auto()
CONSTRUCTOR = auto()
INT = auto()
BOOLEAN = auto()
CHAR = auto()
VOID = auto()
VAR = auto()
STATIC = auto()
FIELD = auto()
LET = auto()
DO = auto()
IF = auto()
ELSE = auto()
WHILE = auto()
RETURN = auto()
TRUE = auto()
FALSE = auto()
NULL = auto()
THIS = auto()
# Symbols Start here
BRACE_OPEN = auto()
BRACE_CLOSE = auto()
PARAN_OPEN = auto()
PARAN_CLOSE = auto()
SQUARE_OPEN = auto()
SQUARE_CLOSE = auto()
DOT = auto()
SEMICOLON = auto()
PLUS = auto()
MINUS = auto()
MUL = auto()
DIV = auto()
AND = auto()
OR = auto()
LT = auto()
GT = auto()
EQ = auto()
NOT = auto()
COMMA = auto()
# Other Tokens
IDENTIFIER = auto()
INTEGERCONSTANT = auto()
STRINGCONSTANT = auto()