Slide 14
Slide 14 text
Parser
One token at the time
• Is there
a
method to p
a
rse the current token?
• INT, TRUE, FALSE, STRING, FUNCTION
• IDENT,
• BANG, MINUS,
• LPAREN, LBRACKET, LBRACE
• IF
• Is there
a
nother token on the right,
a
nd does it h
a
ve the correct precedence?
• Is there
a
method to p
a
rse the next token?
• PLUS, MINUS, SLASH, ASTERISK, LT, GT, EQ, NOT_EQ
• LPAREN e.g., myFuction ( …
• LBRACKET e.g., myArray [ …
• 1 + 2 + 3 => ((1 + 2) + 3)
14