CS 451-651   Homework #3  -- set up CUP+jFlex tools

First Part (to be done by Wednesday, Sept 23):  Install the tools

If all is well, ant will build a scanner and parser (as demonstrated in class) and report "0 errors".

If you don't have a recent version of ant or java, it might not build.
module load ant
(as ant is not normally installed on the unix system, for some dark reason).

Second Part (to be done by Monday, Sept 28):  learn your way around

Using the parser and scanner provided, run some programs through and start to become familiar with what is happening.  (This should parse the same language as your top-down parser, without the IF statement).

And then:



Where we're going:

We'll exchange the simple-program grammar for one which is more like Java, including simple variable (and array) declarations and more complete expressions.  Using this, we'll define data structures (classes) and build a parse tree, which we'll then process in later portions of the compiler.


Very brief guide to CUP and jFlex:



The Parser I've supplied is set to read input from the terminal;  or it may be given, as a command-line argument, the name of a file to read from.

I've supplied several versions of Parser.cup.  Use a symbolic link (or cp or mv) to select the one you want.  (The file name 'Parser.cup' is known to build.xml.  In general, we'll just be working with one parser, so this is not a problem.




If you're interested, there's a short manual available for CUP and jFlex.
  (we'll not be using the material about operator precedence)