
     CSE 109    Program 7     Due   9 PM Monday 24 November 2008
     (Late collection dates: 9 PM Monday 1 December, Tuesday 2 December)

     This assignment has two distinct steps, which should be preceded by
     your copying the files from the directory p6 into the directory p7.
     YOU SHOULD READ ALL THE INSTRUCTIONS FOR THIS ASSIGNMENT BEFORE
     STARTING, PAYING SPECIAL ATTENTION TO THE FIRST NOTE BELOW.

     First, modify, as needed, the class Parser and the subclass ParserASM
     developed for p6 so that the call to the method parse() (continues to
     parse STKMASM code and) generates the STKM code that corresponds to a
     syntactically correct STKMASM program. Modify p6.cc, so that running p6
     generates STKM code.

     Second, copy p6.cc into p7.cc, keeping the file p6.cc for later use.
     Create a subclass of your class ParserASM, say ParserASMPP, such that
     when you replace an instance of ParserASM with an instance of ParserASMPP
     in p7.cc your program parses and generates code for programs satisfying
     the complete syntax for the STKMASM++ language.  Thus, it should be able
     to handle lines of STKMASM++ code like

         branchto 600 >=
         write  two*(x-3-y-z)/20
         push 5+3*y

     That is, your p7 should be able to handle full-blown arithmetic
     expressions and all forms of branchto.

     Your program should read the command line, require that the command
     line have exactly three arguments,  and then use the three
     files listed on the command line, the first for input, the second
     for storing the results of the parse, and the third for storing the
     code generated. The input file should consist of what purports to
     be an STMKASM++ program.  The first output file should consist of
     the results of the parse, including a message that the STKMASM++ program
     is correct, or a diagnosis of the first parse error.  If the parse
     succeeds, the second output file should have the corresponding STKM
     code, including the text listed after "end" in the input file.

     To submit your assignment, create a subdirectory of /csc109.084 called
     p7 (that is, from your root directory csc109.084/p7) for doing your
     work.  Indicate you wish the assignment to be collected by touching
     the unix command "touch DONE", which will create a file of 0 bytes named
     DONE.  Then all files in the subdirectory p7 (but not in subdirectories
     of the subdirectory p7) will be collected. I will test your programs
     in p6.cc (which should act like stkmasm) and in p7.cc (which should act
     like stkmasm++) by using your Makefile, first executing the command
     'make clean'. I will first test your new version of p6.cc by executing
     the command "make p6".  This should execute the command in your makefile
     that is labeled "p6". I will run your new p6 with sample STKMASM
     input files, some syntactically correct, some not.  I will use stkm to
     run the code generated from syntactically correct programs.  Then I will
     execute the command "make", which should execute the (default) command
     that is labeled "p7" and that compiles p7. I will then test your p7 in
     the same way as I test p6.

     NOTE: IT IS VERY IMPORTANT THAT YOU IMPLEMENT THIS ASSIGNMENT SO THAT
     ParserASM IS A SUBCLASS OF Parser AND ParserASMPP IS A SUBLCASS OF
     ParserASM.

     Note: Except for .o files accessed from /proj/csc109/p6, all files you
     use should be in the p7 directory. IT IS IMPORTANT THAT YOU DO NOT
     have your makefile refer to files from directories that you created
     for earlier assignments. Such files will not be collected. My attempt to
     "make" your code will fail, causing me some consternation.  You want to
     avoid that.

     Note: I have stored some STKM and STKMASM++ files that I will use to
     test your programs p6 and p7 in /proj/csc109/p7.

     Even though I am happy that I have detected little evidence of unfair
     collaboration this semester, I repeat still again, read the statement
     in the syllabus about what it means to unfairly collaborate.

