A simple FRACTRAN interpreter written in Koka.
FRACTRAN is a Turing-complete esoteric
programming language invented by the mathematician John Conway. A FRACTRAN
program is an ordered list of positive fractions, together with an initial
positive integer
The program is run by updating the integer
- For the first fraction
$f$ in the list for which$nf$ is an integer, replace$n$ by$nf$ . - Repeat this rule until no fraction in the list, when multiplied by
$n$ , produces an integer, then halt.
Clone the repository:
git clone https://github.com/yourusername/fractran-koka.git
cd fractran-kokaYou can run the interpreter using the Koka compiler:
koka src/main.kk -- examples/mul.frac 12Or build an executable:
koka -o fractran src/main.kk
./fractran examples/mul.frac 12The examples/ directory contains some sample FRACTRAN programs:
mul.frac: Multiplication program.prime.frac: Conway's prime-generating program.sample.frac: A simple test program.
src/: Source code in Koka.fractran.kk: The core FRACTRAN library.main.kk: CLI entry point.
examples/: Sample FRACTRAN programs.
This project is licensed under the MIT License - see the LICENSE file for details.