Stax 1.2.0
Stax 1.2.0
Interpreter deprecation
Up until now, I've been maintaining two implementations of the stax language "specification".
- The official web-based stax interpreter, as hosted on https://staxlang.xyz/
- A C# CLI implementation
Henceforth, only the first one will be maintained. The C# CLI was the first implementation, but it no longer serves much purpose, so it's deprecated. It will stay on version 1.1.10.
JS bigint
support now required
Up until now, native ES2020 bigint
was used opportunistically. For environments that didn't have support, the npm big-integer
package was used. This dependency as been removed. That means that stax intperpreter now requires a javascript environment with native bigint
support. Fortunately, that's almost everything.
It's not all removals though. Some stuff was added too.
Features
- New instruction:
:e
calculatesexp(x) = e ** x
for any numeric valuex
. - New output control characters. There are three control characters that have new behavior when output.
- Carriage Return - When encountered, clear the current line of output. Codepoint: 13. This is
"`3"
in a string literal. The|.
instruction outputs a single carriage return. - Form Feed - When encountered, clear all output. Codepoint: 12. This is
"`5"
in a string literal. The|:
instruction outputs a single form feed. - Backspace - Remove the previous character of output, if any. Codepoint: 8. There's no specific literal support. You can output one using
8]p
.
- Carriage Return - When encountered, clear the current line of output. Codepoint: 13. This is
- New instruction:
|,
. This will pause execution for one frame. (as defined byrequestAnimationFrame
) Useful for animations e.g.W|,|:30m|i+A:_|8A*@11+'*)
. - New "RNG"-ish instruction
|'
. The outputs of these use a deterministic PRNG that's seeded with the program's source code, so the output is repeatable, but it looks random. The behavior depends on the type of the top value on the stack.- Given an array, choose an element.
- Given an integer, choose a non-negative that's lower.
- Given a float, chose a non-negative float that's lower.
- New "eval" instruction
l
. Given a string of stax code, just execute it. The debugger will step over this code. It's not possible to step "into" the code evaluated in this way. - When output is produced during execution, the document automatically scrolls to show it.
- Fixed a bug that occurred when using the
\n\n+
input separator without providing any input. - Fixed a bug when using the Compress Literals button on a program containing unterminated string literals.
- Fixed a bug in the interpreter that would cause block terminators to get mis-parsed in certain contexts like
{{}{}F
. Thanks Razetime.