|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsmithers.extras.Brainfuck
public class Brainfuck
Implementer for the brainfuck programming language. This implementation
defaults to the following:
The program is 30000 chars, the memory is 30000 bytes. The
program is read from a file, input and output are on System.in and
System.out. The data cells are 1 byte in size, and wrap around.
This version adds an extra command, '#', which dumps the memory to output in
hexadecimal.
Some of the previous can be changed however. See the contructor
documentation for details.
| Constructor Summary | |
|---|---|
Brainfuck(int progLen,
int dataLen,
boolean useDump,
java.lang.String sourceFile)
Creates a new instance with the program from a file and some of the options changed. |
|
Brainfuck(java.lang.String sourceFile)
Creates a new instance with the program from a file. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
Main method, evaluates the arguments and runs the program in the specified file. |
void |
run()
Runs the program until it finishes. |
void |
step()
Executes a single step. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Brainfuck(int progLen,
int dataLen,
boolean useDump,
java.lang.String sourceFile)
throws java.io.IOException
progLen - the length of the program arraydataLen - the length of the data arrayuseDump - whether to use '#' to dump the data arraysourceFile - the file to read the program from
java.io.IOException
public Brainfuck(java.lang.String sourceFile)
throws java.io.IOException
sourceFile - the file to read the program from
java.io.IOException| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablepublic void step()
public static void main(java.lang.String[] args)
throws java.io.IOException
| Argument | Meaning |
|---|---|
-pN |
Sets the length of the program array to N. |
-dN |
Sets the length of the data array to N. |
| --nodump | Turns off the use of '#' to dump the data array. |
| (Anything else) | Sets the file name. |
args - the arguments
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||