Select this to skip to main content [CSUSB] >> [CNS] >> [Comp Sci Dept] >> [R J Botting] >> [CSci620] >> lab07 [Source]
[Index] [Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Search] [Grading]
Mon Apr 19 15:26:48 PDT 2004

Contents


    CS620 Laboratory 7

    Goal: understand the book's interpreter better

    Process: Working in pairs: one typing and one commenting

    1. 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.

    2. It compiles -- check this!
    3. It runs! Download this program to test this: [ lab07.prog ]
    4. Make a copy of the original interpreter:
       		cp lab07.cpp lab07.cpp.org
    5. However when I created lab07.cpp I made a couple of mistakes. Test it work with different programs. Start with these
      1. a+b+c$
      2. a+b-c$
      3. a+b+c+a+b$
      4. a+b*c$
      5. a*b+c$
      6. a+b/c$

      When you hit an expression that is misinterpretted find the bug in the code and fix it.
    6. Change the initial set of values for a, b, and c in the main program and make it work.
    7. Add new variables to the initial set.
    8. Improve the style and structure of the code!
    9. 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.

    Glossary

  1. BNF::="Backus-Naur Form", for syntax and grammar, developed by Backus and Naur.
  2. EBNF::="Extended " BNF.
  3. HTML::= "HyperText Markup Language", used on the WWW.
  4. HTML_page::syntax= "<HTML>" head body.
  5. Java::="An " OO " Language from Sun".
  6. LISP::= "LISt Processing Language".
  7. LRM::="Language Reference Manual".
  8. OO::="Object-Oriented".
  9. Prolog::="Programming in Logic".
  10. TBA::="To Be Announced".
  11. UML::="Unified Modeling Language".
  12. URL::=Universal_Resource_Locator,
  13. Universal_Resource_Locator::syntax= protocol ":" location, where
    Net
    1. protocol::= "http" | "ftp" | "mailto" | ... ,
    2. location::= O( "//" host) O(pathname).

    (End of Net)
  14. WWW::= See http://www.csci.csusb.edu/dick/cs620/, index to web site for this class.
  15. 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