Reference no: EM131415154
You have been provided with a framework for a java application. It will not compile because there is a class and method missing (Visitor::visit). Your assignment is to create the visit method and whatever other methods you see fit. There are some rather unusual rules, though:
1) You may not use loops (while, for, do/until). Any looping that needs to happen must happen via recursion.
2) You may create ONLY local variables. You may NOT create members or globals.
3) You may NOT submit changes to any of the classes in the framework. You MAY and SHOULD, however, add your own tests to "Main" and test your code thoroughly.
4) Visitor must be a static class with only static methods. All methods except Visit must be private.
Visitor will be passed a "StatementsNode". Visitor must print assembly instructions in the following format:
##: opc op1,op2
For example:
0: add R0,R1
or
1: sub $1000,$2000
or
3: jmp $9999
The first value is a sequence number and is incremented after an instruction is printed.
There are two types of operand:
RegisterOperand - this represents a register in the CPU. It contains a single int. Print these as R# (R0, R1, R2, etc)
AddressOperand - this represents an address in the computer's memory. It contains a single long. Print these as $# ($1234, $3456), etc. Don't worry about forcing a certain number of decimal places.
Do not assume that if an instruction uses one type of operand, all of the operands will be of the same type. It is perfectly acceptable to have this:
add R0,$2000
There are three types of instruction node:
StatementsNode - this node contains a list of Nodes. Print each node in the list. The list will never be null or empty.
TwoOperandNode - this node represents math - add, sub, mul, div. Each node has two operands and a "type" character (one of +, -, *, /).
WhileOperand - this node represents a while loop. It contains two StatementsNodes - statements and conditions. Here is the format for a WhileOperand:
$X: <<<conditions>>>
bne $00000000
<<<statements>>>
jmp $X
X has to match the counter of the first instruction in the conditions. Neither statements nor conditions can be null or empty.
Attachment:- JAVA Assignment.zip
Consultant demonstrated how our aggregate remuneration
: The consultant demonstrated how our aggregate remuneration might be ameliorated by modifications in our propensities to utilize credit for compensating for services. She also endeavored to ascertain which of our characteristics were analogous to thos..
|
How can a firm take maximum advantage of mobile technology
: How can a firm take maximum advantage of mobile technology, more specifically, mobile apps, and what it has to offer?
|
Human resource mgmt assignment
: There are several standardized training events in large organizations that are required annually or biannually. One of these is often sexual harassment. For this assignment, write a training plan for all employees in your firm to educate and devel..
|
After watching the videos write an analysis
: After watching the videos, write an analysis. The paper should be an account of the key issues or problems in the video, followed by a critique of the videos.
|
Create the visit method and whatever other methods you see
: You have been provided with a framework for a java application. It will not compile because there is a class and method missing (Visitor::visit). Your assignment is to create the visit method and whatever other methods you see fit. There are some ..
|
Identify two event planning software available
: Identify 2 Event Planning Software available. Evaluate their website and identify the strengths and weaknesses of each of the software you selected. Look at the software in relationship to the 5 phase event planning process. Identify the areas that w..
|
Why is hbse relevant to social work
: The types of issues and concerns that children, and adolescents, present to social workers are as varied as the people themselves. Understanding how individuals behave in their particular environment will shed some light on their current challenge..
|
Employee training and development
: Text book is Employee Training and Development sixth edition by Raymond A. Noe The name of the class is BHR 4680, Training and Development, Columbia Southern University Chapter 4 Learning and Transfer of Training. Describe the learning condition you ..
|
What is meant by a consumer-driven long-term care system
: What is meant by a "consumer-driven" long-term care system? What are some of the rights and responsibilities of long-term care consumers? What are the components of accessibility to long-term care services?
|