After getting the code go inside the root folder.
npm install
to install all the dependencies
Then run the command.
npm link
Tests can be run
npm test
After this you should be able to run any program
tur program.tur
tur is an interpreted programming language running on a simulated turing machine. (The program is not stored on the turing machine only data)
The turing machine simulation here does not use "states" instead the operations (Left / Right) (done by the states) can be done with the commands and if statements and states can be repeated with the loop command. This is done to have a structure of a normal programming language. Though, adding a dedicated state mechanism is my intention. States would be like objects with 4-tuple representations. The normal programming structure along with states would give ease of learning along with a chance for the user to understand the concept of a turing machine.
The following are the commands
- right - To move a step right
- left - To move a step left
- show - To print the symbol at the current place
- show_tape - To print the whole tape
- write < symbol > - To write a symbol at te current place
- loop < condition > - For looping
- if < condition > - Simple if condition
- else - Else for if
- endblock - To end a loop or if block
Currently there are only two conditional operator eq
for checking if the current symbol is equal to the given symbol and neq
for checking if the current symbol is not equal to the current symbol.
if eq 1
print got_1
endblock
In case of loop it runs until the condition is false.
For an example tur program check the program.tur file.