https://github.com/jmbhughes/tapelanguage
A basic programming language on a tape
https://github.com/jmbhughes/tapelanguage
programming-language tape turing-machine turing-machine-simulator
Last synced: 2 months ago
JSON representation
A basic programming language on a tape
- Host: GitHub
- URL: https://github.com/jmbhughes/tapelanguage
- Owner: jmbhughes
- License: mit
- Created: 2018-03-07T22:36:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T00:52:45.000Z (over 8 years ago)
- Last Synced: 2025-10-13T11:36:34.407Z (9 months ago)
- Topics: programming-language, tape, turing-machine, turing-machine-simulator
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TapeLangauge
A basic programming language on a tape
This project was inspired by an assignment for the Spring 2018 Programming Languages assignment at Williams College using a trivial language called Breph. The language has been modified here. The language operates very simply with a data array, like a Turing Machine tape, and a simple set of commands:
| Command | Action |
|:---------:| ---------------------------------------- |
| p | Print whatever the data pointer is over |
| l | Move the data pointer left one position |
| r | Move the data pointer right one position |
| + | Increment the value under data pointer |
| - | Decrement the value under data pointer |
| ( | If the value at data pointer is zero, then jump to matching ) and execute following command. Otherwise, move to next instruction. |
| ) | If the value at data pointer is nonzero, then jump back to matching ( and execute the following command. Otherwise move to next instruction. |
| i | Take input and place at data pointer location |
## Requirements
This requires `Python 3` and the `argparse` package.
## Example programs
Some simple examples have been provided in [examples/](./examples/). Notice that the first line is the input for the program to run (what is accessed with the I command) and the rest of the code is on the following line.