// HACKER NEWS — CYBERSECURITY
A few feral cats in an ALGOL trenchcoat.
The syntax of POP-2 is ALGOL-like, assignments are in the infix notation, but the evaluation scheme is deeply concatenative.
The language has the explicit notion of an operand stack. Thus, the prior assignment can be written as two separate statements where the first one leaves a value on the stack, and the second, consumes it:
The language can easily be compiled for Uxn, in fact, the language is so elegant and small that an entire compiler is less than 800 lines and fits within 2.5kb of memory.
At first glance, the language looks a little like Pascal. A statement begins with a keyword, followed by expressions, terminated by a semi-colon. Evaluation consists of moving through the program leaving values on the stack as needed.
But it's important to remember that everything is evaluated by a stack machine, a function returning multiple values, is merely leaving them on the stack for the next one to use.
The comment statement will block out a length of text until a terminating semi-colon.
Variables are allocated inside the vars statement, these can be of any length, by default in a 16-bit system, a variable is made of two 8-bit cells.
At first glance, the language looks awfully unsurprising, but notice how each case pushes a value on the stack instead of returning a value or doing an assignment:
Functions are declared in the typical ALGOL fashion, recursion leaves the arguments on the stack:
Loops are written with simple GOTOs, there are no iterators.