-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDocumentation - Interpreter.txt
38 lines (32 loc) · 1.56 KB
/
Documentation - Interpreter.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
User Manual
===========
How to use Interpreter.java:
- Compile Interpreter.java
- Run "java core/Interpreter filename inputfilename", for example "java core/Interpreter test1 test1_input1"
- Input data is printed, then Program is parsed, printed, and executed.
How to use Interpreter class in code:
- Get a Tokenizer object ready to use with the program input (explained in tokenizer documentation)
- Instantiate an Interpreter object, passing in the tokenizer object and input data into the constructor
- Program is then parsed, printed, and executed
Interpreter Design
==================
Interpreter class:
- Contains the tokenizer
- Contains input data
- Contains core program object
- Contains mapping of ids to values
- Contains utility methods to shortcut checking/expecting/skipping tokens in various orders
Node, Program, Statement etc OO core classes:
- Represent a part of the core program
- Holds references to other data that makes up the node (such as expression in assignment)
- Handles parsing, pretty printing, and execution for itself
main method:
- The tokenizer is setup as explained previously in tokenizer documentation
- Input data is read in a similar fashion as the program file
- Interpreter is instantiated which subsequently parses, prints, and executes the program
Testing
=======
Manual testing was performed with the included files "test1", "test2", and "test3".
These files were provided by the instructor on the course website.
Further extensive testing was performed by messing with these files to test all OO core classes and possible bugs
No known bugs exist.