/** * * Author: Joanne Louise Carter * Date: 06/01/05 * Module: G6DICP Introduction to Computer Programming * Title: ICP Coursework 3 * SCSiT Username: jxc04m * */ ------------------------------------------------- | TPL Interpreter | ------------------------------------------------- The Read Me File ================ How to run this program: ------------------------ If you have the JDK (Java Developement Kit) installed on your computer then you can run the program by accessing the folder in which the program is installed through the Command Prompt. Then type java at the prompt to run (you do not need the .class extension as the program automatically adds this) e.g: java cw3d factorial.tpl. If you do not have the JDK then you can download the the JRE (Jave Runtime Environment) from Sun and run the program by typing jre at the prompt. Part E (.jar archive) can also be run by typing "java -cp TPLinterpreter.jar cw3e", and then entering the filename at the prompt. PLEASE NOTE: That the ".tpl" you are trying to run must be in the same folder as the .class or .jar file. You may use one of the sample files in the TPL files folder, and copy and paste it as needed; or you may create your own. What the Program does: ---------------------- This program is designed to intepret Tiny Programming Language (TPL) files and output (provided they are written correctly) what they are written to output. Only TPL files can be processed, i.e: files that end with the extension ".tpl". Any errors in the code end the interpreter and output a sensible error message. Part A: Merely outputs the text of the file. Part B: Checks for an END statement. Part C: Deals with Comments and PRINT(LN) statements. Part D: Implements the entire range of reserved words. Part E: Extends the TPL range of reserved words. Those marked with * are only available in this part. Reserved Words: --------------- INTEGER Declares integer type variable (INTEGER variable) STRING Declares string type variable (STRING variable) BOOLEAN* Declares boolean type variable (eg: BOOLEAN variable TRUE) LET Assigns a variable (LET variable=value) CALCULATE Performs one arithmetic calculation * This can also be used to add Strings together, one calculation at a time. PRINT Writes data to the console PRINTLN As print, but followed by a new line IF* Allows series of statements to be executed if a condition is true (eg: IF variable EQUALS value) END IF* It must be terminated by an END IF * (Conditions Allowed: "EQUALS", "NOT", "LESS", "GREATER") INPUT* User can input a value for a String or Integer variable (not Boolean). (eg: INPUT variable), instead of using LET END Terminates the program List of files included: ----------------------- cw3/readme.txt (this file) cw3/taskA/cw3a.class cw3/taskA/cw3a.java cw3/taskB/cw3b.class cw3/taskB/cw3b.java cw3/taskC/cw3c.class cw3/taskC/cw3c.java cw3/taskD/cw3d.class cw3/taskD/cw3d.java cw3/taskD/TPLinteger.class cw3/taskD/TPLinteger.java cw3/taskD/TPLstring.class cw3/taskD/TPLstring.java cw3/taskD/TPLutils.class cw3/taskD/TPLutils.java cw3/taskD/TPLvariable.class cw3/taskD/TPLvariable.java cw3/taskE/cw3e.class cw3/taskE/cw3e.java cw3/taskE/TPLboolean.class cw3/taskE/TPLboolean.java cw3/taskE/TPLinteger.class cw3/taskE/TPLinteger.java cw3/taskE/TPLinterpreter.jar cw3/taskE/TPLstring.class cw3/taskE/TPLstring.java cw3/taskE/TPLutils.class cw3/taskE/TPLutils.java cw3/taskE/TPLvariable.class cw3/taskE/TPLvariable.java cw3/javadoc/index.html - double click this to access the javadoc documentation (Part E) cw3/TPL files/ - sample .tpl files to test the programs with Limitations: ------------ This program should run on any platform as Java is a platform independant programming language. It has been tested on the Windows XP operating system, and Unix (via Exceed). It should also work with any recent version of the JDK (since 1.4.2), including the most recent (1.5.0) - as it does not use deprecated code. NB: If the binaries are compiled in JDK version 1.5.0 then they will not work in version 1.4.2 without being recompiled. These binaries have been re-compiled by version 1.4.2 before submission to ensure they work correctly for the markers (as I had this problem with FizBuz) - this is not true vice versa: there is forwards compatibility, just not backwards.