Topple
Topple, created by User:H33T33, was developed using C.
Topple (conditionally) ignores whitespace, which means you can cram everything into one line. Good luck with that though.
Overview
Unless otherwise specified, whitespace in any given code example is purely for organization.Command | Description | Example(s) | Output |
---|---|---|---|
.
|
"Admits” a given character
|
a. b. c.
|
None |
,
|
Outputs characters w/o admitting them | a,b,c,
|
abc
|
@
|
Outputs all admitted characters and deletes them | a.b.c. @
|
abc
|
&
|
Outputs all admitted characters without deleting them | a.b.c. &
|
abc
|
|
|
Deletes all admitted characters | a.b.c.| @
|
None |
:
|
Outputs an admitted character at a given index (deleted upon use)
|
a.b.c. 0:
|
a
|
;
|
Takes admitted character from a given index and copies it.
|
a.b.c. 0; @
|
abca
|
=
|
Defines variables
|
a=1
|
None |
^
|
Calls variables
|
a=1 a^. @
|
1
|
!
|
Takes user input | !. @
|
Whatever the user inputs |
?
|
Compares two values. Returns ‘1’ if the two are the same or ‘0’ if the two are not the same (last admitted characters, deleted upon use) | a.b.?. @
|
0
|
#
|
Returns a random number between 0 and 9 | #. @
|
0-9
|
<...>
|
FOR Loop, loops based on a given amount (last admitted character, deleted upon use) | 3.<a.@>
|
aaa
|
(...)
|
IF Statement, conditionally runs code based on a given character (last admitted character, deleted upon use) | 1.(a.@)
|
a
|
[...]
|
ELSE Statement, will run only if the last IF Statement did not | 0.(a.@)[b.@]
|
b
|
{...}
|
WHILE Loop, will run as long as the last admitted character (checked at the start of each loop) is non-zero | 1.{a.@}
|
aaaaaaaaaaa...
|
_..._
|
Used for commenting | _a.b.c.@_
|
None |
+
|
Increments an admitted character at a given index
|
1.2.3. 0+@
|
223
|
-
|
Decrements an admitted character at a given index
|
1.2.3. 0-@
|
023
|
*
|
Breaks from a loop. If not inside a loop, quits the program |
Special Characters
Character | Description |
---|---|
\
|
New Line (\n) |
Programmer's Notes
This was my first programming language, and I am so proud of it. It started just as an idea. I wanted to know if I could do it, and I could, and I continue to. This took roughly 3-4 months to make, and it was more than worth it, even though it still needs lots of work done to it
The source code will be provided along with multiple examples of the syntax and how to use the language as soon as I finish debugging.
I added WHILE loops, but I'm unsure what to do with the below. It should be Turing Complete now, but I'll leave that to the professionals to decide.
Computational class
In its current iteration, Topple is total, but could be Turing complete if it had access to an infinite loop construct.
The admitted characters list can be used as the word of a tag system. An initial word can be admitted by simply admitting each character in turn. To check a character to see which rule to produce, the pattern 0;. C. ? (x. y. z.)
can be used for each rule. The C
is the character which produces the rule when at the start of the word, and x. y. z.
are the characters to add to the end of the word. The pattern copies the start of the word, pushes the character to check, then compares them whilst deleting them, pushing 1/0 to the word. The brackets then remove that last character from the word and conditionally perform the rule. This only ever changes the word if the rule was matched, and only according to the rule.
A list of tag system rules can be translated into Topple by using the above construction for each rule. At the end of the list m many 0:
can be used to delete characters from the start of the word. For a 2-tag system 0: 0:
would be used.
There are likely several other equally powerful reduction schemes for Topple (perhaps using variables), however, the language is total. There is no way to perform an infinite loop, as the only loop available (the FOR loop) is only able to loop a finite amount of times.