CS 3723 Programming Languages
Answer to First Question
Recently a student asked:
> I am having a difficult time trying to figure out what exactly do
> you want us to do with the Project O. Do you want us to write the input
> and output like the examples that you have; do you want us to write the
> code, their numeric values, and the output; or just the output? For
> instance, should one file countain 1)f=100, 2)0: {LIT, 100, -, t50}, &
> 3)81 100 -1 50; while the program reads this and generates and output, or
> should the read 2 & 3 in a file and produce and output, or just read a
> file containing 3?
Here is my reply:
Subject: Re: Project O
Look at the text of Project 0 carefully. It helps if you
understand perfectly what the inputs are like and what the
outputs are like. In the sample example, the input is a file containing
the following and nothing else:
81 5 -1 50
81 8 -1 51
11 50 51 52
41 52 -1 0
81 8 -1 53
11 0 53 54
41 54 -1 1
56 1 -1 -1
61 -1 -1 -1
Just the nine lines of 4 integers to each line.
Your program should read all that data and put it into
an array of 9 quadruples (or a 2-dimensional array).
Then your program should set a variable loc = 0,
and start with quadruple number loc. The intent of
each quadruple is carried out, and afterward loc
in incremented, except for a jump quadruple (not present
above), in which case loc takes on a new value.
Execution should continue until the quadruple 61 -1 -1 -1
is executed (a halt). In this example there is a
single write quadruple: 56 1 -1 -1, which should write
either 21 or 21.0 or 21.000000000, etc.
YOU DO NOT NEED ANY OF THE FANCY LISTINGS AND OUTPUT
THAT I HAVE SHOWN. That's just to try to make the
assignment clearer.
For full credit for the assignment, your program should
handle "First run" and "Second run". In those examples,
the inputs are bold and the only required outputs are also
bold. Your output should look roughly like what is shown,
except that all your output numbers can have a decimal point.
-- Neal Wagner
*-----------------------------------------------------------------*
* Neal R. Wagner, Assoc. Prof., Division of Computer Science *
* University of Texas at San Antonio, San Antonio, Texas 78249 *
* Tel:(210)458-5550, Fax:(210)458-4437, E-mail:wagner@cs.utsa.edu *
* Web page: http://www.cs.utsa.edu/~wagner/ *
*-----------------------------------------------------------------*
* The future, always so clear to me, had become like a black *
* highway at night. We were in uncharted territory now, making *
* up history as we went along. *
* Sara Conner, Terminator 2 movie *
*-----------------------------------------------------------------*