Machine that has a single register and six instructions

Assignment Help Basic Computer Science
Reference no: EM13313489

Assume a machine that has a single register and six instructions.

LD A Places the operand A into the register
ST A Places the contents of the register into the variable A
AD A Adds the contents of the variable A to the register
SB A Subtracts the contents of the variable A from the register
ML A Multiplies the contents of the register by the variable A
DV A Divides the contents of the register by the variable A

Write a java program utilizing stacks that accepts a postfix expression containing single-letter operands and the operators +, -, *, and / and prints a sequence of instructions to evaluate the expression and leave the result in the register. Use variables of the form TEMPn as temporary variables.

For example, using the postfix expression ABC * + DE - / should print the following to the console:

LD B
ML C
ST TEMP1
LD A
AD TEMP1
ST TEMP2
LD D
SB E
ST TEMP3
LD TEMP2
DV TEMP3
ST TEMP4

Reference no: EM13313489

Questions Cloud

Write a program to ask the user to enter the amount spent : Write a program to ask the user to enter the amount spent on food and Gas for each day of the week. Count and display the number of days the user spent more than 20 dollars per day on food and more than 10 dollars/per day on gas.
How far is the object from the converging lens : A converging lens (f1 = 24.0 cm) is located 56.0 cm to the left of a diverging lens (f2 = -28.0 cm). How far is the object from the converging lens
Review evans and richardson : How specifically does economic of scale serves as a value for global branding? since higher volume doesn't necessarily translate into value for global acceptance of a brand
Find how far from the lens is the object : An object is placed to the left of a lens, and a real image is formed to the right of the lens. How far from the lens is the object
Machine that has a single register and six instructions : Machine that has a single register and six instructions
What is the index of refraction of the unknown liquid : A layer of oil (n = 1.45) floats on an unknown liquid. A ray of light originates in the oil and passes into the unknown liquid. What is the index of refraction of the unknown liquid
What is the difference between syntax and semantics : Explain the distinction between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm.
What is the tension in the cables : A 20 Kg loudspeaker is suspended 2.0 m below the ceilling by two cables that are each 30' from vertical . What is the tension in the cables
Describe the ka of lactic acid hc3h5o3 : The Ka of lactic acid, HC3H5O3, is 1.410?4. (a) Suppose buffer #1 is prepared using 40.0 mL 0.1 M HC3H5O3 and 60.0 mL 0.1 M C3H5O3- to give a final volume of 100.0 mL. What is the pH of this buffer

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd