Getting Started

Download RecursiveDescentJava.zip. Import it into your Eclipse workspace.

Your task

Modify the parser so that it supports parenthesized expressions.

Do so by adding the following production:

F → ( E )

You will need to modify the lexer so that it supports left and right parentheses as terminal symbols:

You will also need to modify the parseF method in the parser class so that it applies the F → ( E ) production when appropriate.

Testing

Try running the program and entering the expression

(a + b) * 3

Solution

You can see a solution here: RecursiveDescentSoln.zip