You can edit almost every page by Creating an account and confirming your email.

Swatch Programming Language

From EverybodyWiki Bios & Wiki



Swatch

Swatch is a programming language developed by Brian Dean Ullery in 2022.[1] It consists of 5 characters: t, o, u, x, and +.[1]

Memory

In Swatch, you only have two variables to work with: Dynamic Main (DM) and the Static Secondary (SS). The purpose of DM is to be the frontend of user interaction. It is what gets affected by its counterpart, SS. SS is a variable with a set range between -9 and 9, generally falling into patterns when a program needs it. SS starts at 0. Entirely independent of DM, not affected by DM whatsoever, and purely backend – essentially pulling the strings from behind in order to make DM look good. When taking input or any user interaction in Swatch, the input directly overrides DM. Besides these directly editable variables, there's also the Function Array (FA). Finally, the call stack size is 5000. So when in a loop, after the loop goes back into itself for the 5000th time, it throws an error.[1]

Commands
t Performs a transfer between SS and DM. In summary, it adds whatever is in SS to DM.
o Creates a function and stores it in the FA. If there are more o's, then it creates another function in between them.
u Takes whatever is in DM, converts it from Decimal to ASCII, and outputs it to the screen.
x Takes whatever is in SS, finds a function at that index, and executes said function. Indexes start at 0.
+ Adds one to SS. If SS is at 9, it makes SS -9.
Comments Anything that isn't listed above is ignored by the compiler.

Functions and Command Variants

FA stores all the functions created within the program. In a function, each command does something different than before except for t and o.[1]

u Variant Takes input from the user. Converts the input from ASCII to Decimal and saves it to DM, overriding it.
x Variant Executes a function at the index of DM instead of SS.
+ Variant Adds one to DM instead of SS.

The "HELLO WORLD!" Program in Swatch

+o

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    u
++++++++++++++++++
    tttu
+
xxxxxxx
    uu
xxx
    u
++++++++++
    ttttt
+++++++
    tu
++
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    u
++++++++++
    t
+++++++++
x
    u
xxx
    u
+++++++++++++
    tut
++++
    tu
++++++++++++
    ttt
+
    tu

Online Compiler

[2]https://runswatch.tk/

References

  1. 1.0 1.1 1.2 1.3 "Swatch, Swatch+, and Their Online Compilers. — Brian Dean Ullery". Buy Me a Coffee. Retrieved 2022-05-27.
  2. "Swatch - The Online Swatch Compiler". runswatch.tk. Retrieved 2022-05-27.



This article "Swatch Programming Language" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Swatch Programming Language. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.