Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java - Compiler and exe FIRST PASS HINT Second PAss Hint (30 marks) P5: The Compiler Focus: Data structures, exception handling, stepwise refinement, putting-it-all together
Java - Compiler and exe
FIRST PASS HINT
Second PAss Hint
(30 marks) P5: The Compiler Focus: Data structures, exception handling, stepwise refinement, putting-it-all together The last part of this big project is the creation of the compiler for our simulated computer Among other aspect, you will work on the use of Java Lists. The TestComputer class would now be as follows Computer compnew Computer//1 comp.compile ("program.asm") comp.run ("program.ex"); In the above program, the computer will compile the file provided as parameter (i.e. program. asm) in statement #2. The result is an executable file that should be saved in the same folder with the same name and the extension .ex instead of.asm. That is, the output of statement 2 above is an executable file called program.ex saved in the same folder as program.asm. The above program will then execute the compiled file (ie, program. ex) using the run method as shown in statement #3 OVERVIEW OF OUR ASSEMBLY LANGUAGE: To compile means translating from one language to another language. For us, it will mean translating from assembly language to machine language. Our assembly language is composed of three components: the instructions, two directives, and labels. (1) The instructions: The following table shows the relationship between the assembly language keywords and the Operation Code used in our machine language Assembly language keywords STOP LD STO ADD SUB MPY Operation Code Assembly language Operation 01 02 03 0 4 05 keywords DIV IN OUT Code 06 07 08 09 10 BGTR BZ (30 marks) P5: The Compiler Focus: Data structures, exception handling, stepwise refinement, putting-it-all together The last part of this big project is the creation of the compiler for our simulated computer Among other aspect, you will work on the use of Java Lists. The TestComputer class would now be as follows Computer compnew Computer//1 comp.compile ("program.asm") comp.run ("program.ex"); In the above program, the computer will compile the file provided as parameter (i.e. program. asm) in statement #2. The result is an executable file that should be saved in the same folder with the same name and the extension .ex instead of.asm. That is, the output of statement 2 above is an executable file called program.ex saved in the same folder as program.asm. The above program will then execute the compiled file (ie, program. ex) using the run method as shown in statement #3 OVERVIEW OF OUR ASSEMBLY LANGUAGE: To compile means translating from one language to another language. For us, it will mean translating from assembly language to machine language. Our assembly language is composed of three components: the instructions, two directives, and labels. (1) The instructions: The following table shows the relationship between the assembly language keywords and the Operation Code used in our machine language Assembly language keywords STOP LD STO ADD SUB MPY Operation Code Assembly language Operation 01 02 03 0 4 05 keywords DIV IN OUT Code 06 07 08 09 10 BGTR BZStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started