ADD -> '+'
SUB -> '-'
MUL -> '*'
DIV -> '/'
ASS -> '='
SQM -> '\''
DQM -> '\"'
NUM -> [0-9]+
WORD -> ([a-z] | [A-Z])+
STR -> \" [^\"]+ \"
CMT -> ("//")(!('\n')) -> skip
SPA -> ' ' | '\t' | '\n' -> skip
PTHL -> '('
PTHR -> ')'
BRKL -> '['
BRKR -> ']'
BRCL -> '{'
BRCR -> '}'
KEYWORD -> "print" |
"fun" | "main" | "ret"
string -> DQM STR DQM
negative -> SUB NUM
factor -> (PTHL expr PTHR) | NUM | IDN | negative
term -> factor ((ADD|SUB) factor)*
expr -> term ((MUL|DIV) term)*
assign -> IDN ASS expr
print -> KEYWORD<0> PTHL (IDN | string | char) PTHR
program -> KEYWORD<1> KEYWORD<2> PTHL PTHR BRCL (assign | print)+ KEYWORD<3> NUM BRCR
tip: The BOLD grammar is completed.