Topple

From Esolang
Jump to navigation Jump to search

Topple, created by User:H33T33, was developed using C.

Development began on December 19th, 2024.

Overview

Unless otherwise specified, whitespace in any given code example is purely for organization
Command Description Example(s) Output
. "Admits” a given character
  • Does not ignore whitespace
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)
  • 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
^ Calls variables
  • Does not ignore whitespace
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, 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.@} aaaaaaaaaaa...
_..._ Used for commenting _a.b.c.@_ None
+ Increments an admitted character at a given index
  • Does not ignore whitespace
1.2.3. 0+@ 223
- Decrements an admitted character at a given index
  • Does not ignore whitespace
1.2.3. 0-@ 023
~ Clears console a.b.c. @ ~ None
* Quits the program

Special Characters

Character Description
\ New Line (\n)


Disclaimer: The current source file is bugged. The fixed file will be added ASAP

Source Code

C Source Code

Hello, world!

H.e.l.l.o. ,.~ .w.o.r.l.d.@!,

Examples of the syntax and how to use the language will be added in the near future.


I am unsure what to do with the below as this is my first time doing this. I added WHILE loops, so 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.