summaryrefslogtreecommitdiff
path: root/grammar-ll1.txt
AgeCommit message (Collapse)AuthorFilesLines
2016-05-08grammar-l11: remove left-recursionPeter Wu1-8/+10
In the original change, the EXP in PROD-EXP should have been PROD-EXP, similarly EXP in SINGLE-EXP should have been SINGLE-EXP. Otherwise the operator precedence is not applied correctly (consider 1+2*3, it should be interpreted as 1+(2*3), not (1+2)*3). Anyway, this change removes left-recursion as described in 2.12.1.
2016-05-07Attempt to convert grammar to LL(1)Peter Wu1-11/+8
Needs more verification, but the idea is that the expressions with lowest precedence (+) should be the first one in the parse tree (implying that non-terminals with highest precedence should be just above a terminal). Left-associativity is achieved by the trick in section 2.3.1 of Intro2CD which results in the left operand being recursed instead of the right one.
2016-05-07Initialize LL(1) grammar from current grammarPeter Wu1-0/+41