A programming language for designing Turing machines
Project description
Alan
A programming language for designing Turing machines.
Walkthrough | Installation | Wiki | Citation
Installation
pip install alan
Walkthrough
This section describes a workflow.
For an in-depth guide navigate to the Wiki. Here are some useful links:
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:
alan graph examples/binary-palindrome.aln -f assets/readme/binary-palindrome.png
Run the machine on some inputs:
-
alan run examples/binary-palindrome.aln 101
Accepted Initial Tape : 101 Final Tape : 10
-
alan run examples/binary-palindrome.aln 1010
Rejected Initial Tape : 1010 Final Tape : Y010
Animate the computation on some inputs:
-
alan run examples/binary-palindrome.aln 101 -a -f assets/readme/binary-palindrome-accepted.gif
-
alan run examples/binary-palindrome.aln 1010 -a -f 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}},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file alan-0.4.2.linux-x86_64.tar.gz
.
File metadata
- Download URL: alan-0.4.2.linux-x86_64.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f75547d5c8d2c9562c3dcf2c0975528d237b5884069cb0e9e547f43a26a2957 |
|
MD5 | cf183d50464dd56c748cf739a95f4f42 |
|
BLAKE2b-256 | e7bfc4e34a0fdadf40cd807762c2a08cfe43be7c216873a26c3a3d0a09edfa62 |