https://github.com/thesignpainter98/texfuck
A dirty TeX interpreter for Brainfuck
https://github.com/thesignpainter98/texfuck
brainfuck brainfuck-interpreter tex
Last synced: 3 months ago
JSON representation
A dirty TeX interpreter for Brainfuck
- Host: GitHub
- URL: https://github.com/thesignpainter98/texfuck
- Owner: TheSignPainter98
- License: gpl-3.0
- Created: 2019-01-31T15:13:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-31T18:27:28.000Z (over 6 years ago)
- Last Synced: 2025-01-27T22:16:51.634Z (5 months ago)
- Topics: brainfuck, brainfuck-interpreter, tex
- Language: TeX
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# texfuck ─ A small, dirty Brainfuck interpreter written in TeX
## Usage
To execute from the console, use:
```sh
tex bf
```
or some derivative (e.g. `pdftex`, `pdflatex` etc.)Alternatively, it may be included in a LaTeX document using:
```LaTeX
\input{brainfuck}
```
then calling `\brainfuck [program]^`.Example: `\brainfuck ++++++++[>++++++++<-]>+.^` evaluates to `A`
## Problems
This implementation is _very dirty._
TeX's `\count` variables are used to hold memory tape values, this leads to two problems:- There are only 256 possible memory positions :(
- Some positions are used for other stuff, so you may **overwrite important TeX values! D:****_I take no responsibility for the consequences of the last point should it occur!_**
I have attempted to alleviate this by imposing bounds on accessible memory.## Idiosyncratica:
- Input is in numbers but output is in the default encoding
- Programs must end with the `^` when called using `\brainfuck`