CS200 Lab 6, Parsing Expressions

Overview

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

Take the InfixSum codes from InfixSum.jar.

The provided TokenIterator is ***VERY PRIMITIVE***. It does not read tokens as defined in the programming assignments. It only reads one character tokens. Extend the code in ParseTreeExpr so that it parses full arithmetic expressions:

   expr = term ( "+"|"-" term )*
   term = factor ( "*"|"/" factor )*
   factor = "-" factor | number | "(" expr ")"

You can use your own token iterator or the primitive one provided.