This program allows creation, loading, editing, and stepping through your own computational programs with the four commands:
- V <- V + 1 (Increment)
- V <- V - 1 (Decrement)
- V <- V (Dummy)
- IF V != 0 GOTO L
In addition, there are 3 macro commands.
- GOTO L
- V <- 0
- V <- V'
- In this machine, you may initialize your input in the top text field INSTEAD OF on the top of the program. Use a comma as a deliminator for each variable initialization.
- Acceptable input:
X=3
,Y=1,X=2,Z=3
,X=3,Y=4
, etc.
- Acceptable input:
-
Editor ignores/works around:
- Empty lines (space out your work)
- Lines containing "//" (comment or take out a line instead of deleting it)
- Trailing/Leading white-space (so you don't have to worry about checking for white-space)
-
The variable names are treated as Strings; you can use any variety of numbers and letters, for example;
Xp res Y1
... Try to stay away from doing this in your final solution as this does not really conform to the language rules.
-
Every time you click "Step" or "Run," the current program in the editor is saved automatically to a text-file
"lang-l-current-program.txt"
in your current working directory. This is so that if you accidentally program yourself into an infinite loop and the machine freezes, you have your work saved. -
The editor automatically loads
"lang-l-current-program.txt"
if it is located in the current working directory.
- Once you've set your program by clicking "Setup/Reset" or using
SHIFT-ENTER
, you may now run your program or step through it.- Every time you step through your program, you will leave a history in the output area to go back and revise previous steps, executions, and snapshots.
- You can choose the amount of steps you would like to take per "Step" button click or
ENTER
hits. - HINT: If you seem to have an error in your code, narrow your clicking and your searching by using the number of steps to jump to a specific execution.
- If you would like to use
ENTER
to execute your program, do so in any of the text fields (not the program editor). You may also hold down theENTER
and watch as the variables change in real-time. - Since variables are not allowed to be negative in this language, the machine will ignore decrements at 0.
- The File Manager automatically opens on the current working directory.
- You may open any
*.txt
file into the editor.- When you open a file, remember that you're not changing the file being opened. You've opened it into the current editor's memory. Again, once you click Step/Run, the
"lang-l-current-program.txt"
is then overwritten with the current editor contents.
- When you open a file, remember that you're not changing the file being opened. You've opened it into the current editor's memory. Again, once you click Step/Run, the
- You may save anything in your editor to a separate text file in the File menu.
- Add line numbers for each instruction. (Requires new JFX lib)
[A]
IF X != 0 GOTO B
Z <- Z + 1
IF Z != 0 GOTO E
[B]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