Skip to content

Stax 1.2.0

Compare
Choose a tag to compare
@tomtheisen tomtheisen released this 17 Jan 18:04
· 7 commits to master since this release

Stax 1.2.0

Interpreter deprecation

Up until now, I've been maintaining two implementations of the stax language "specification".

  1. The official web-based stax interpreter, as hosted on https://staxlang.xyz/
  2. 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 calculates exp(x) = e ** x for any numeric value x.
  • 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.
  • New instruction: |,. This will pause execution for one frame. (as defined by requestAnimationFrame) 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.