TEWNLSWAC

Pronounced toons-whack, TEWNLSWAC is an idea for a programming language by User:Zseri. It's inspired by TEWELSWAC, but uses a very different syntax. The name stands for: The Esolang Where No Line Starts With A Colon.

TEWNLSWAC was created as a more golfed version of TEWELSWAC with additionally object orientation.

Memory Model
TEWNLSWAC is an internally stack based language, but uses variables in the frontend.

A symbol is an reference to a constant dynamically allocated container of data.

A variable is a name for a symbol. Any variables are global, but you can emulate local variables using objects.

All parameters to functions are passed via symbols.

Syntax
Most lines of code are like this: command args;

When a condition is specified, the syntax is: (condition) { commands... }

When no condition is specified, the line is executed no matter what. All whitespace is supported.

The  is used to separate commands. Newlines after this are not necessary.

Labels are just special commands, because they don't have a semi-colon as separator, but a colon: identifier:

A comment starts with  that goes to the end of the line.

Expressions
Expressions are used within lines of code as conditions or arguments. They could be enclosed in s (parentheses). An example of an expression is  or. The expression will return a value. You can nest these.

Variable Assign Commands
The first argument is always a variable.

Ternary
The first argument is always an object variable, the second argument is always a identifier (identifies a key of an object).

Cat
_: p @ + '\n; g _;

Fibonacci sequence
A = 0; B = 1; LOOP: p A; p '\n; C = A; A = B;  B = B + C; (C < A) { g LOOP; } (C = A) { g LOOP; }

Truth-machine
(0 = !) { g F; } T: p "1\n"; g T; F: p "0\n";

99 bottles of beer
B = 99; A = " bottles of beer"; C = " on the wall"; D = "No more"; loop: p B; p A;  p C;  p ".\n"; p B; p A;  p ".\nTake one down, pass it around.\n"; B = B - 1; p B; p A;  p C;  p ".\n"; (B) { g loop; } p D; p A; p C; p ".\n"; p D; p A; p ".\nGo to the store, buy some more.\n"; p 99; p A; p C; p ".\n";

Object Orientation
// based on zeiksh/examples/oopex.zkl Hello = o; Hello.say = &Hello_say; Hello.juge = &Hello_juge;

Dog = Hello; Dog.juge = &Dog_juge;

Hex = Hello; Hex.say; MyDog = Dog; MyDog.say; e;

Hello_say: a this; p "I say: "; p this.juge; p "\n"; r;

Hello_juge: a this; r "Hello World!";

Dog_juge: a this; r "Wouff!";

Computational class
ABCDXYZ can be compiled into TEWNLSWAC, but ABCDXYZ's computational class is unknown. TEWNLSWAC is at least capable of simulating a Bounded-storage machine, but it is probably Turing-complete (prove needed).

External Resources

 * interpreter, by User:zseri, License: MIT