>> [Comp Sci Dept]
>> [R J Botting]
Mon Apr 19 15:26:48 PDT 2004
CS620 Laboratory 7
Goal: understand the book's interpreter better
Process: Working in pairs: one typing and one commenting
- Download the the rough C++ translation
[ lab07.cpp ]
of the interpreter on pages 93..98.
Note: I have include some output statements for debugging (// cerr<<).
If you remove the two slashes(//) you can watch the program entering
that function. Function that are derived from productions
have the production listed as a comment in their header.
- It compiles -- check this!
- It runs! Download this program to test this:
[ lab07.prog ]
- Make a copy of the original interpreter:
cp lab07.cpp lab07.cpp.org
- However when I created lab07.cpp I made a couple of
mistakes. Test it work with different programs. Start with these
When you hit an expression that is misinterpretted find the bug in the
code and fix it.
- Change the initial set of values for a, b, and c in the main
program and make it work.
- Add new variables to the initial set.
- Improve the style and structure of the code!
- Be ready to show me the difference between your code and the orginal:
diff lab07.cpp.org lab07.cpp
Deliverable: Your grade will depend on how far you have got with
the above steps by the end of the laboratory. Each pair-programming
team gets 100% of the allocated points.
- BNF::="Backus-Naur Form", for syntax and grammar, developed by Backus and Naur.
- EBNF::="Extended " BNF.
- HTML::= "HyperText Markup Language", used on the WWW.
- HTML_page::syntax= "<HTML>" head body.
- Java::="An " OO " Language from Sun".
- LISP::= "LISt Processing Language".
- LRM::="Language Reference Manual".
- Prolog::="Programming in Logic".
- TBA::="To Be Announced".
- UML::="Unified Modeling Language".
- Universal_Resource_Locator::syntax= protocol ":" location, where
- protocol::= "http" | "ftp" | "mailto" | ... ,
- location::= O( "//" host) O(pathname).
(End of Net)
- WWW::= See http://www.csci.csusb.edu/dick/cs620/,
index to web site for this class.
- XBNF::="eXtreme" BNF, developed by the teacher from EBNF, designed
to ASCII input of syntax, semantics, and other formal specifications.
Formulae and Definitions in Alphabetical Order