COMP204 2008 Assignment Two This assignment exercises your IO skills. You are to implement a simple interpreter which can read and write doubles from a binary file and do some rudimentary computation. The actions of the interpreter will be specified by reading commands from standard input (think very simple scripting language). The following grammar defines the syntax of command lines: line = OPEN filename | location <= location operator location operator = + | - | * | / | POWER location = VARIABLE offset | FILE offset "OPEN filename" opens the respective file for IO. It will close any currently open file. So at each time there will be only one open file. "filename" is the name of some binary file containing only double numbers. All computation should use double values. "offset" will be of type "int". You should use RandomAccessFile to be able to read and write arbitrary locations inside the binary file. "FILE offset" designates some position in that file. You will read from that location (if that location is used on the right-hand side of the assignment operator "<=") or write to that location (if that location is used on the left-hand side of "<="). Similar for "VARIABLE", but these values are kept in memory, i.e. you need to setup some data-structure to keep track of "VARIABLE"s. "VARIABLE"s are to be initialized to 0.0. In addition all lines will print some feedback to standard output: OPEN prints "opened " Assignments print location and result, e.g. "FILE 13 <= 34.2" if location 13 in the file was assigned 34.2 So assuming binary file "numbers" contains exactly two binary doubles: 1.0 and 2.0 in that order, then the following lines OPEN numbers VARIABLE 0 <= FILE 0 + FILE 1 FILE 0 <= FILE 1 * VARIABLE 0 would first open file "numbers", then sum the double values 1.0 and 2.0 (found at positions 0 and 1) to 3.0 and assign that value to "VARIABLE" 0. Third step computes 2.0 * 3.0 (file position 1 times variable 0) and save that value as the new first value in file "numbers". So after that numbers would contain 6.0 and 2.0 in that order instead of 1.0 and 2.0. Due date: Monday, 11th August What to submit: One java file containing all your code. Document your code well. Use the javadoc @author tag to give your name and ID!