42 school subject.
In OCaml using functional-programming I implemented a single headed and single tape Turing machine from a description provided in json.
The Turing machine is the first mathematical and algorithmic model behind a general purpose computer.
- To install all dependencies use
make env
. We expect you to be on mac with 'brew' available. - Now compile and create the program executable named 'ft_turing'. Use
make
to compile to byte-code with the 'ocamlc' compiler or usemake opt
to compile to machine-code with 'ocamlopt'. - To run the Turing machine launch the executbale with as first argument a json file describing a machine and as second argument machine input. For example like this
./ft_turing machines/unary_sub.json "111-11="
.
Tu clean the compilation file use make fclean
.
To clean and compile back use make re
or make re_opt
.
- ./ft_turing machines/unary_sub.json "111-11=" (should equal "1")
- ./ft_turing machines/unary_add.json "11+11111=" (should equal "1111111")
- ./ft_turing machines/palindrome_or_not.json 11011 (should equal "y")
- ./ft_turing machines/palindrome_or_not.json 1011 (should equal "n")
- ./ft_turing machines/0n1n.json 000111 (should equal "y")
- ./ft_turing machines/0n1n.json 000 (should equal "n")
- ./ft_turing machines/02n.json 0000 (should equal "y")
- ./ft_turing machines/02n.json 0 (should equal "n")
artainmo - OCaml
Turing Machines Explained - Computerphile
Turing Machine Primer - Computerphile
Busy Beaver Turing Machines - Computerphile
Turing Complete - Computerphile
Turing Machines - How Computer Science Was Created By Accident