wsjq is an interpreter and debugger for the Whitespace programming language, written in jq.
wsjq --help
wsjq hworld.ws
wsjq run hworld.ws
whoami > name.txt
wsjq debug --in-file=name.txt --no-prompt name.ws
wsjq disasm fact.ws
wsjq --jq=gojq hworld.wswsjq works with jq 1.8.0, gojq, and jaq.
To run it with jqjq, checkout the jqjq-compat
branch and use wsjqjq instead of wsjq.
wsjq prints to stdout by generating a stream of strings that are immediately
emitted, rather than by appending to a buffer. wsjq sets the main input source
to be stdin so that user input is streamed line-by-line with input. The
contents of the Whitespace source file are then bound to the $src variable
with --rawfile.
When running with jq, integers have 53 bits of precision, because jq uses 64-bit
floating point numbers, and readc collapses CRLF to LF on Windows, because
input strips line endings according to the current OS.
Run with gojq (--jq=gojq) to use arbitrary-precision integers and preserve
line endings.
bf.jq by itchyny
(blog post)
and bf.jq by
MakeNowJust are Brainfuck interpreters written in jq, though neither support the
, read operator and both display . output on program termination.
jqjq by Mattias Wadman is a jq interpreter in jq.
The jq standard library filters defined in builtin.jq are a helpful reference for learning advanced usage.
As a large and complex jq program, wsjq has directly driven several improvements in various jq engines:
- gojq
- Bug with nested path and variable-style parameters #186: fixed by itchyny
- jqjq
- Running wsjq #10:
add
index/1,test/1,split/2,halt_error/1,bsearch/1, andin/1, and resolve symlinks - Resolve user-defined filters before intrinsics #13:
fix
def debug - Add string interpolation support by wader
- Format json with
JQ_COLORS#14: add-M/--monochrome-outputand-j/--join-output - Staged CLI #19:
add
-f/--from-file,--arg,--rawfile, and--unbuffered - Remaining:
-R/--raw-input,-L/--library-path, andinclude
- Running wsjq #10:
add
- jaq
- Missing builtins (
bsearchand more) #293: addbsearchby 01mf02 - Incorrect lexing of compound operators with unary minus #294: fixed by 01mf02
- Convert inputs of
jointo strings: fixed by 01mf02
- Missing builtins (
This project is made available under the Mozilla Public License, v. 2.0.