Skip to content

Instantly share code, notes, and snippets.

@seletskiy
Created June 20, 2012 19:16
Show Gist options
  • Select an option

  • Save seletskiy/2961648 to your computer and use it in GitHub Desktop.

Select an option

Save seletskiy/2961648 to your computer and use it in GitHub Desktop.
Thue: convert arbitary number to binary
COMMENT::=Converts arbitary number to binary.
COMMENT::=Number must be surrounded by ^ and $.
1::=(on)|
2::=(tw)|
3::=(th)|
4::=(fo)|
5::=(fi)|
6::=(si)|
7::=(se)|
8::=(ei)|
9::=(ni)|
0::=|
(on)::=i
(tw)::=i(on)
(th)::=i(tw)
(fo)::=i(th)
(fi)::=i(fo)
(si)::=i(fi)
(se)::=i(si)
(ei)::=i(se)
(ni)::=i(ei)
|$::=.ED
i.::=.i
io::=oi
iO::=Oi
I.::=.I
Io::=oI
IO::=OI
To::=oT
TO::=OT
x.::=.x
xo::=ox
xO::=Ox
y.::=.y
yo::=oy
yO::=Oy
xI::=Ix
+.::=.+
+o::=o+
+O::=O+
e.::=.e
eo::=oe
eO::=Oe
&o::=o&
&O::=O&
|.::=o|
|o::=Oo|T
|O::=o|T
^O::=^o
^o::=^T
T::=e++++++++x
xi::=iIx
x|::=y|
xq|::=x|
x$::=y$
Iy::=yI
iy::=yi
+y::=x
xey::=xw
^ey::=^qw
|ey::=|qw
wi::=iw
wI::=iw
qi::=iq
w|::=|
q|::=
^.::=^
iE::=Ei
^E::=B@#
#i::=i#
@i::=!
!i::=p@
Bp::=B!
!p::=p@
@p::=!
#D::=`
@`::=`@
!`::=`!
B`::=OK
OK!::=O_one_K
OK@::=O_nul_K
_one_::=~1
_nul_::=~0
::=
^1234$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment