3460:430/530  Theory of Programming Languages                                                                            Fall 2005

Dr. C.-C. Chan                                                                                                                                      Due:  9/25/05

Project #2  (25 pts)

 

Problem:  Based on Project 1, extend the language to allow the following features:

 

1.  Use semicolon instead of newline to separate input expressions.

 

            2. Allow assignment operator, =, has the lowest priority and is right associative.

 

            3.  Allow an input expression to across multiple lines.  e.g.,

                        x =

                        1 + 3

                        + 4;

            should be treated as a valid input.

 

            4.  Variable names may be up to 32 characters long and consist of letters of upper or lower cases.  They are case-insensitive.  Each variable has a unique name.

            5.  Add a built-in function printvars that prints out values of variables defined in the symbol table.  The function name is case-insensitive.  The built-in function command is ended with semicolon as in other statements. 

                 E.g.:  printvars;   // it would invoke the built-in function

 

            6.  Add an escape mechanism using character ‘!’ that would allow the user to run system shell commands.  E.G.:  !vi  would invoke the vi editor.  After finishing vi editor, the execution flow would back the interpreter.

 

 

           

Implementation:

            1.  Add new token types for built-in functions.

            2.  Add new rules and corresponding actions to reflect the new features.

3.                              Extend yylex function to recognize new features.

4.                              You must create a symbol.c source file to implement the symbol table.

 

 

Submissions:

1.  Name your source files as "lastname_p2.y" and "lastname_symbol.c".

2.  Send the source file by e-mail to sk39@uakron.edu   and chan@cs.uakron.edu

3.  The project is due by midnight of the due day.