GiavaScript is an open-source, cross-platform JavaScript runtime implemented in Crystal.
It intentionally does not aim for full ECMAScript compliance. Check the reference docs before relying on specific language features.
- Crystal 1.19.1 or later
- Python 3 (only needed to regenerate
reference/REFERENCE.md)
git clone https://github.com/memburg/GiavaScript.git
cd GiavaScript
./install.shThis installs the giavascript binary to /usr/local/bin by default.
Install to a user-local path instead of /usr/local/bin:
INSTALL_DIR="$HOME/.local/bin" ./install.shMake sure your install directory is on PATH.
giavascriptREPL commands:
:quitexits the REPL.
giavascript path/to/program.jsBehavior to expect:
- Empty files return an error.
- If a runtime error occurs, messages are written to standard error.
- Process exit code is
1when anyError:message is produced; otherwise0.
crystal run src/giavascript_cli.cr -- examples/templateLiterals.jsInstall dependencies and run tests:
shards install
crystal specRegenerate consolidated reference docs after editing files under reference/:
python3 scripts/generate_reference.pyCI verifies that reference/REFERENCE.md matches generated output.
Sample programs are in examples/:
examples/templateLiterals.js- string interpolation and expression formattingexamples/arrayFlatFlatMapSplice.js- array manipulation methodsexamples/dateBasics.js- Date object usageexamples/functionExpressionsAndOperators.js- function expressions and operatorsexamples/multilineMethodChaining.js- method chaining patternsexamples/objectKeysValuesEntries.js- Object.keys, values, entriesexamples/random.js- random number generationexamples/tryCatchFinally.js- error handling with try/catch/finally
Run any example with:
giavascript examples/templateLiterals.jsSee CONTRIBUTING.md for setup, test, and documentation update guidelines.