Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taco-c/trainfuck
Interpreter for the Trainfuck language, based on Brainfuck.
https://github.com/taco-c/trainfuck
brainfuck esolang esoteric-language experiment programming-language
Last synced: 29 days ago
JSON representation
Interpreter for the Trainfuck language, based on Brainfuck.
- Host: GitHub
- URL: https://github.com/taco-c/trainfuck
- Owner: taco-c
- License: mit
- Created: 2018-12-12T01:03:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-28T18:04:23.000Z (over 4 years ago)
- Last Synced: 2024-11-05T11:15:14.775Z (3 months ago)
- Topics: brainfuck, esolang, esoteric-language, experiment, programming-language
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trainfuck.py
Trainfuck.py is a interpreter that interprets the Trainfuck language which is derived from the
[Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) language, but the Trainfuck
language differs in a few ways:* Numbers! Instead of writing `++++++++++`, you can write `+10`. This also works
for `-`, `>`, `<`, `.`, and `:`.
* One more output char: `:`! Colon prints the numerical value of the cell instead
of the ASCII representation.
* `@` sets the data pointer to `0`. So you can can go to any numbered cell from anywhere using ie. `@>200`.
* It doesn't have `,`. It's not really needed is it?## How to run
You will need Python 3. That's it.
```
python trainfuck.py
```
or just
```
./trainfuck.py
```For the file extension I like to use `.tf` (if Brainfuck is `.bf`). But don't let
that stop you from using something more fun, like `.trainfuck`.## Hello World
```
+72.+29.+7..+3.-67.-12.+55.+24.+3.-6.-8.-67.-23.
```
It also supports:
```
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
```
or any variations.## More examples
Take advantage of calculating with big* numbers!
(*Maximum number is 255.)
Multiplication:
```
+20[->+11<]>:
```Divition:
```
+150[-25>+<]>:
```## Compatibility with Brainfuck
Trainfuck is to Brainfuck what C++ is to C: able to interpret the code of its predecessor. Of course not perfectly because that would be boring. Should be able to execute Brainfuck code as long as:
* Code does not rely on Comma.
* Comments don't contain any numbers or colon (Except in a comment at the top
inside a pair of []'s).