Assignment 5 – Symbols Dean Zeller: CS380 Assignment Due: Friday, September 27th by 5:00 P.M. 10 Points For the fifth assignment, you are to add to the functionality of Assignment 3 by generating tokens for reserved words and user-defined symbols as well as literals and operators for a Small source code file. Assign a unique Internal Compiler Code (ICC) to every symbol, and display the token list, literal table, and symbol table at the end of the source code listing. Upon completion of the compilation, print a list of all tokens generated, 25 per line. Your ICC must be significant for at least 5 characters of the symbol name. Tokens Num 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20-27 Symbol Error = , [ ] ; { } : ( ) + * / -> < == <= . 28 29 30 31 32 33 34 35-41 else goto if int read while write 42-299 300-399 Explanation Syntax error Equal Sign Comma Left Bracket Right Bracket Semicolon Left Brace Right Brace Colon Left Parenthesis Right Parenthesis Plus Minus Times Divide Assignment Less Than Test Equality Test Less Than or Equal To Test End of Program (reserved for extensions) (reserved for extensions) User defined symbols Literal values Errors Detected: Error 1 – EOF read, no end of program operator (.) Error 2 – Illegal operator Error 3 – Literal too large Error 4 – Illegal digit in literal Error 5 – Literal table full Error 6 – Symbol table full Grading Correctness and Design Basically, did the program generate the proper sequence of tokens and check for the appropriate errors. You will also be graded on the object oriented design in your program. Documentation, Style, and Appearance Every program method must have a block of documentation describing the method. There must also be a class documentation giving brief descriptions all methods within the class. Use the Stack.java handout as a guide for what is expected. The only programming style required is the correct use if indenting blocks of code and the use of blank lines to separate logical chunks of code. Include your printouts in a neat and organized portfolio. Testing You must thoroughly test your code to ensure it works correctly. If your code was not tested enough to demonstrate that everything works, I will assume it does not work and grade accordingly. Test your compiler at least twice. For the first test, use the sample program from the previous assignments. For the second test, create a program of your own that uses most of the Small language functions. The output generated by your program should contain the tokens generated for each line, plus the list of all tokens for the program. Following the source code listing and token list, display the literal table and the symbol table. You do not need to test for errors 5 and 6 in your program, but you must program them. On your source code listing, label where this testing is completed. Turning in your assignment Add the following printouts to your portfolio: This assignment sheet Documented source code, with Errors 5 and 6 labeled or highlighted Test-runs (2)