raulpy271 / turingMachine

๐Ÿ“ผ Create and shows Turing machine working in terminal screen

Home Page:https://raulpy271.github.io/turingMachine/turingMachine/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Turing Machine Visualizer

Image showing the execution

To visualize turing machines there the app turingmachine.io, on it, to create machines you should use a yml file, which is'nt a programming language. So, I created this app to visualize turing machines, which are created in a programming language, this give to you the power to do whathaver machine you want.

Now, the machines is visualized throught the terminal, but, it can be extend to others interfaces. Besides, the language that is used to program is Ocaml, but I have the goal to execute in javascript using js_of_ocaml module.

Usage

This package use dune as build system. So before run the app, install dune and the dependecies using:

$ opam install .

Now, build the package and run it:

$ dune build

$ dune exec turing

This will execute the machine write_msg.ml because in the main module (bin/turingMachineCli.ml) was imported your functions. If you want create a machine, you need to create a module in the examples directory and use it in the main module. So, change the fallowing code in the main:

module Machine = struct
  include Write_msg (* Change `Write_msg` to the name of your module *)
end;;

After it, you can create your machine. To do it, you need to create these tree values:

let machine: (symbol, state) Data.turingMachine = 
  (* Your machine definition *)
;;

let string_of_state : state -> string = 
  (* Function to convert a state to string *)
;;

let string_of_symbol : symbol -> string = 
  (* Function to convert a symbol to string *)
;;

The main module will use these three values of your module to show the machine execution in the screen. To see a simple example of machine check the repeat_0_1 machine.

You probably have realized that to create a machine, your need to create a value of the type ('symbol, 'state) Data.turingMachine. The type symbol defines the type of the value of each cell in the tape, and the type state defines what is the state of the machine. To better understand these data types, read the generated documentation of the module Data.

Besides, you can also view the documentation of each module. Feels free to add features, ideas or something great, I will like it ๐Ÿš€.

About

๐Ÿ“ผ Create and shows Turing machine working in terminal screen

https://raulpy271.github.io/turingMachine/turingMachine/index.html

License:MIT License


Languages

Language:OCaml 98.6%Language:Makefile 1.4%