Topple/Topple 1

From Esolang
(Redirected from Topple/Versions/Topple 1)
Jump to navigation Jump to search

←Back

Interpreter Sources

Overview

The first working version of Topple, completed on June 22nd, 2025.

Single-Character Commands

Unless otherwise specified, whitespace in any given code example is purely for organization
Command Description Example(s) Output
. "Admits” a given character as well as activates most other command characters
  • Does not ignore whitespace
a. b. c. None
@ Outputs all admitted characters and deletes them a.b.c. @ abc
, Outputs characters without admitting them
  • Does not ignore whitespace
a,b,c, abc
! Takes user input !. @ Whatever the user inputs
? Compares the last two admitted values. Returns ‘1’ if the two are the same or ‘0’ if the two are not the same a.b.?. @ 0
# Returns a random number between 0 and 9 #. @ 0-9
& 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
  • Does not ignore whitespace
a.b.c. 0: a
; Takes admitted character from a given index and copies it.
  • Does not ignore whitespace
a.b.c. 0; @ abca
= Defines variables
  • Does not ignore whitespace
a=1 None
~ Clears console a.b.c. @ ~ None
* Quits the program

In hindsight, creating a command that relies entirely on indexes in a language that only allow integers between 0 and 9 wasn't a good idea.

Multi-character Commands

None of these will ignore whitespace

Command Description Example(s) Output
^. "Admits" a given variable a=1 a^. @ 1
^+ Increments a given variable by 1 a=1 a^+ a^. @ 2
^- Decrements a given variable by 1 a=1 a^- a^. @ 0
<...> FOR Loop, loops as many times as the last admitted character 3.<a.@> aaa
(...) IF Statement, conditionally runs code if and only if the last admitted character was not equal to 0 1.(a.@) a
[...] ELSE Statement, will run only if the last IF Statement did not 0.(a.@)[b.@] b
{...} WHILE Loop, Takes a given variable and loops for as long as it is non-zero
  • Variable does not need to be manually called
v=1 v.{a.@}

v=1 v.{a.@ v=0}

aaaaaaaaaaa...

a

_..._ Used for commenting _a.b.c.@_ None

Special Characters

Character Description
\ New Line (\n)

Example Code

Hello, world!

H,e,l,l,o,, ,w,o,r,l,d,!,

Hello, world! (but unnecessarily longer)

a=1

2.<
    a^.(
        H.e.l.    
    )[
        w.o.r.
    ]
    l.
    a^.(
        o.,. .|
    )[
        d.
    ]
    @
    a=0
>
!,

Computational Class

Topple 1 is Turing-complete, as it can easily be compiled from The Waterfall Model. First, create a variable for every waterclock. Then define a variable Q, thats equal to one. Then all the code after this point of translation is contained in a:

Q.{...}

Then, for every variable x, create an if statement:

x^.(| x^-)[| ...]

In the ... section, every variable must be incremented an equal amount to x's zeroing trigger.