Program to convert a program encoding based on its Gödel number to 𝒮 Language (S Language) or convert an 𝒮 Language program to its program number
Launch the program, providing the number as a command line argument:
py -m src.godel_to_code [program number]
For example: py -m src.godel_to_code 52
(The command for Python may be different on your system. See the Python documentation for details.)
Launch the program with the following command:
py -m src.godel_to_code
Enter a program number when prompted.
Enter program number: 99
Y ← Y + 1
Y ← Y
Y ← Y + 1
Enter program number: 25724
Y ← Y
[A1] Y ← Y
Y ← Y + 1
[B1] Y ← Y
Enter program number: 2097151
[A1] X1 ← X1 + 1
Launch the program with the following command:
py -m src.code_to_godel test.s
Where test.s
is the name of the file containing the program.
Launch the program with the code input as a command line argument:
Single line:
py -m src.code_to_godel "Y <- Y + 1"
Multiline:
py -m src.code_to_godel <<EOF
Y <- Y
Y <- Y + 1
EOF
Launch the program with the following command:
py -m src.code_to_godel
Enter the code line by line when prompted. Enter a blank line to end the input.
- Assignment can be represented by
<-
,=
,<=
or←
. - Inequality can be represented by
!=
,=/=
, or≠
. - Labels must only contain indexed letters A-E, and variables must be either
Y
, or an indexedX
orZ
. - Labels without indices will be interpreted as index 1 (eg.
[A]
is equivalent to[A1]
). - Variables without indices will be interpreted as index 1 (eg.
X
is equivalent toX1
). - Valid instructions include:
V ← V
,V ← V + 1
,V ← V - 1
, andIF V≠0 GOTO L
where in all cases,V
represents a variable andL
represents a label as specified above. - Instructions can be preceded by a label in square brackets (eg.
[A]
).
Enter program (press enter twice to submit):
Program number: 0
Enter program (press enter twice to submit):
Y <- Y
[A] Y <- Y
Y <- Y + 1
[B] Y <- Y
Program number: 25724
Enter program (press enter twice to submit):
IF X != 0 GOTO A
Y <- Y + 1
[A1] Y <- Y - 1
Program number: 773094113279999999999999
Command to run tests:
tox
Command to lint with flake8:
py setup.py lint