CS200 Lab 6, Parsing Expressions

Overview

In this lab you will extend the given Sum Parser to a complete Expressions Parser ParseExpr.java. You can test it with ParseDriver.java and inputs in and in2

Take the InfixSum codes from the progress webpage (week 5) or right here InfixSum.jar. You will need to extract the jar file.

Add to these your TokenIter.java from P2. Now extend the code so that it parses full arithmetic expressions:

   expr = term ( "+"|"-" term )*
   term = factor ( "*"|"/" factor )*
   factor = "-" factor | number | "(" expr ")"
You can add debug print statements, so you can follow the sequences of parse events.