%import common.WS %import common.CPP_COMMENT %import common.INT %import common.WORD %ignore WS %ignore CPP_COMMENT start: (LABEL | ainstr | cinstr)* LABEL: "(" WORD ")" ainstr: "@" SYMBOL SYMBOL: WORD | INT | "R" "0".."15" | "SP" | "LCL" | "ARG" | "THIS" | "THAT" | "KBD" | "SCREEN" cinstr: (DEST "=")? COMP (";" JUMP)? // not satisfied with this; could it be cleaner? DEST: "A" "D"? "M"? | "A"? "D" "M"? | "A"? "D"? "M" JUMP: "JGT" | "JEQ" | "JGE" | "JLT" | "JNE" | "JLE" | "JMP"