Pure Deterministic Turing State Machine, running in Terminal, done with Scala using Cats (having fun with some cool types)
IOMonad (Cats), to give a homogeneous structure (safe, easy to compose)ValidatedApplicative Functor (Cats), to parse the Machine description (JSON file)CursorComonad (handmade, for fun)- built around
Zipper: handmade wrapper to deal withStreamorLazyList(simulating the Machine'shead) - handles (updates, displays) the Machine's
tape
- built around
- parses a JSON description of the Machine (alphabet, states, transitions...)
- parses an input, first content of an infinite
tapethat will be re-written - updates (re-writes) the
tape, according to the machine description - displays every update on stdout
unary_add: a TM made to add 2 unary stringsunary_sub: a TM made to subtract 2 unary stringspalindrome: a TM made to check if a binary string is a palindrome02n: a TM made to check if a unary string is a word of the language 0^2n
sbt "run </path/to/description.json> <input>"or
./compile
./turing </path/to/description.json> <input> [-p]- add tests !
- using State Monad ?
- adding some safety (if needed)
- refactoring
