Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kelvindecosta/alan
:computer: A programming language for designing Turing Machines.
https://github.com/kelvindecosta/alan
computation langauge turing turing-machine
Last synced: about 1 month ago
JSON representation
:computer: A programming language for designing Turing Machines.
- Host: GitHub
- URL: https://github.com/kelvindecosta/alan
- Owner: kelvindecosta
- License: mit
- Created: 2019-01-06T22:21:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-25T21:10:42.000Z (over 4 years ago)
- Last Synced: 2024-10-05T04:21:50.792Z (2 months ago)
- Topics: computation, langauge, turing, turing-machine
- Language: Python
- Homepage: https://pypi.python.org/pypi/alan/
- Size: 3.19 MB
- Stars: 52
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - kelvindecosta/alan - :computer: A programming language for designing Turing Machines. (Python)
README
# Alan
A programming language for designing Turing machines.
Walkthrough
|
Installation
|
Wiki
|
Citation## Installation
```bash
pip install alan
```## Walkthrough
This section describes a workflow.
For an in-depth guide navigate to the [Wiki](https://github.com/kelvindecosta/alan/wiki).
Here are some useful links:* [Definition](https://github.com/kelvindecosta/alan/wiki/Definition)
* [Syntax](https://github.com/kelvindecosta/alan/wiki/Syntax)
* [Interface](https://github.com/kelvindecosta/alan/wiki/Interface)Consider the following example, the definition for a Turing machine that accepts all binary strings that are palindromic:
```
# This is a definition of a Turing Machine that accepts binary strings that are palindromes
' '
A*
'X' 'X' < A
'Y' 'Y' < A
'0' 'X' > B
'1' 'Y' > F
' ' ' ' > G
B # Starting with 0
'0' '0' > B
'1' '1' > B
' ' ' ' < C
'X' 'X' < C
'Y' 'Y' < C
F # Starting with 1
'0' '0' > F
'1' '1' > F
' ' ' ' < E
'X' 'X' < E
'Y' 'Y' < E
C
'0' 'X' < D
'X' 'X' < D
E
'1' 'Y' < D
'Y' 'Y' < D
D
'0' '0' < D
'1' '1' < D
' ' ' ' > A
'X' 'X' > A
'Y' 'Y' > A
G.
'X' '0' > G
'Y' '1' > G
```Graph the machine:
```bash
alan graph examples/binary-palindrome.aln -f assets/readme/binary-palindrome.png
```Run the machine on some inputs:
* ```bash
alan run examples/binary-palindrome.aln 101
``````
Accepted
Initial Tape : 101
Final Tape : 10
```* ```bash
alan run examples/binary-palindrome.aln 1010
``````
Rejected
Initial Tape : 1010
Final Tape : Y010
```Animate the computation on some inputs:
* ```bash
alan run examples/binary-palindrome.aln 101 -a -f assets/readme/binary-palindrome-accepted.gif
```![Animation of accepted input](https://raw.githubusercontent.com/kelvindecosta/alan/master/assets/readme/binary-palindrome-accepted.gif)
* ```bash
alan run examples/binary-palindrome.aln 1010 -a -f assets/readme/binary-palindrome-rejected.gif
```![Animation of rejected input](https://raw.githubusercontent.com/kelvindecosta/alan/master/assets/readme/binary-palindrome-rejected.gif)
## Citation
If you use this implementation in your work, please cite the following:
```
@misc{decosta2019alan,
author = {Kelvin DeCosta},
title = {Alan},
year = {2019},
howpublished = {\url{https://github.com/kelvindecosta/alan}},
}
```