Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Help Help Help

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
I want my program to read in an arithmetic statement consisting of integers and the operators "+" and "-," and outputs a regular LMC assembly language program to a file that can then be assembled by the LMC assembler and run on the LMC.

For example, if the input statement (one line only) is
5 + 3 - 6 + 2

The output should be LMC assembly language program:
.LMC
LOAD NUM1
ADD NUM2
SUB NUM3
ADD NUM4
PRINT
STOP
.DC NUM1 005
.DC NUM2 003
.DC NUM3 006
.DC NUM4 002
.END

Ignored whitespace between characters in the arithmetic expression are ignored and assume that all of the integer values are positive.


Please help.
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same quetion to multiple forums. It just wastes people's time. Since there's a reply in this copy, I'll leave that one open and close this one -- although this isn't really an advanced Java topic.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!