The Elements of Computing Systems, My Workbook for the NAND to Tetris course.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nand2tetris/compiler/keywords.py

48 lines
861 B

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()