Skip to content

Latest commit

Β 

History

233 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GiavaScript Logo

GiavaScript

Crystal Version

CI Nightly Crystal CI

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.

Quick start

Prerequisites

Install the CLI

git clone https://github.com/memburg/GiavaScript.git
cd GiavaScript
crystal run src/giavascript_cli.cr -- install.js

This installs the giavascript binary and a gs shortcut (symlink) to /usr/local/bin by default. Both commands work interchangeably.

Install to a user-local path instead of /usr/local/bin:

INSTALL_DIR="$HOME/.local/bin" crystal run src/giavascript_cli.cr -- install.js

Make sure your install directory is on PATH.

CLI usage

Start the REPL

gs

REPL commands:

  • :quit exits the REPL.

Run a file

gs path/to/program.js

Behavior to expect:

  • Empty files return an error.
  • If a runtime error occurs, messages are written to standard error.
  • Process exit code is 1 when any Error: message is produced; otherwise 0.

Run without installing

crystal run src/giavascript_cli.cr -- examples/templateLiterals.js

Development workflow

Run the tests:

crystal spec

JavaScript feature reference

Examples

Sample programs are in examples/:

  • examples/templateLiterals.js - string interpolation and expression formatting
  • examples/arrayFlatFlatMapSplice.js - array manipulation methods
  • examples/dateBasics.js - Date object usage
  • examples/functionExpressionsAndOperators.js - function expressions and operators
  • examples/multilineMethodChaining.js - method chaining patterns
  • examples/objectKeysValuesEntries.js - Object.keys, values, entries
  • examples/random.js - random number generation
  • examples/tryCatchFinally.js - error handling with try/catch/finally

Run any example with:

gs examples/templateLiterals.js

Contributing

See CONTRIBUTING.md for setup, test, and documentation update guidelines.

About

GiavaScript JavaScript runtime βœ¨πŸ’ŽπŸš€βœ¨

Topics

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages