turingAutomaton/README.md

108 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2020-03-30 16:39:09 -04:00
# turingAutomaton #
2020-03-30 16:35:50 -04:00
a toy programming language for creating turing machines
2020-03-30 16:39:09 -04:00
## description ##
2020-03-30 16:35:50 -04:00
`turingAutomaton` is a programming language created to test the Racket ecosystem. it features custom syntax and is able to run single tape turing machines.
2020-03-30 16:39:09 -04:00
## installation ##
2020-03-30 16:35:50 -04:00
```
git clone https://git.lain.church/tA/turingAutomaton
cd turingAutomaton
raco pkg install
```
2020-03-30 16:39:09 -04:00
## syntax ##
2020-03-30 16:35:50 -04:00
all files must begin with a
```
#lang turingAutomaton
```
followed by a definition of;
```
@ beginningState
% blankSymbol
! acceptingState
```
(currently the accepting state is unimplemented)
`states` are defined using the following syntax;
```
: stateName
currentSymbol ~ newSymbol > newState
currentSymbol ~ newSymbol < newState
```
where `<` and `>` denote moving the tape left and right, respectively
comments are allowed:
```
; either on their own line
@ first ; or at the end of a line
```
2020-03-30 16:39:09 -04:00
## sample program ##
2020-03-30 16:35:50 -04:00
this machine will double a number passed to it
```
#lang turingAutomaton
; this is a comment!
@ first
% e
! F
: first
a ~ b > second
c ~ c > fourth
: second
a ~ a > second
c ~ c > second
e ~ c < third
: third
a ~ a < third
b ~ b > first
c ~ c < third
: fourth
c ~ c > fourth
e ~ e < fifth
: fifth
b ~ a < fifth
c ~ a < fifth
e ~ e > F
```
2020-03-30 16:39:09 -04:00
## caveats ##
2020-03-30 16:35:50 -04:00
currently very unfinished.
all input is a single tape defined with `aaaaa` for now.
there is no error checking until I learn how to do that.
might get slow for very large tapes as the tape uses linked lists to operate.
2020-03-30 16:39:09 -04:00
## thanks ##
2020-03-30 16:35:50 -04:00
mutce ckire to:
* the racket team for creating an awesome language
* Matthew Butterick for his book [Beautiful Racket](https://beautifulracket.com/) and the libraries within
2020-03-30 16:39:09 -04:00
## author ##
2020-03-30 16:35:50 -04:00
`fi'e la ti'ei`