A JavaScript engine written in Zig https://kiesel.dev
Go to file
Linus Groh a465635f4f
All checks were successful
Lint / lint (push) Successful in 32s
Test / test (push) Successful in 40s
Docs / docs (push) Successful in 1m7s
Build / build (push) Successful in 9m9s
language: Improve error location in a few cases
2024-05-08 01:10:17 +01:00
.forgejo/workflows ci: Refactor build workflow 2024-04-24 20:58:55 +01:00
docs docs: Remove reference to test262 transformer 2024-02-17 22:17:49 +00:00
src language: Improve error location in a few cases 2024-05-08 01:10:17 +01:00
.gitignore Initial commit 2023-04-28 19:48:13 +01:00
build.zig build: Add option to enable legacy language features 2024-04-19 19:24:32 +01:00
build.zig.zon build: Update dependencies 2024-04-14 17:10:44 +01:00
LICENSE meta: Happy new year! 2024-01-03 19:04:49 +01:00
README.md meta: Link devlog #7 from the README 2024-04-28 21:57:59 +01:00

Kiesel

A JavaScript engine written in Zig

justforfunnoreally.dev badge License Build

logo

Introduction

Kiesel (/ˈkiːzəl/) is a JavaScript engine written from scratch for the purpose of me learning the Zig programming language, with the eventual goal of full support for the latest ECMAScript standard. It features a custom bytecode VM and runtime, and aims to implement as much as possible in pure Zig - currently with the following exceptions:

  • bdwgc for garbage collected allocations
  • libregexp for regular expressions
  • ICU4X for Intl-related functionality

A simple CLI (REPL/file interpreter) is available but being easy to embed in other projects is also a goal.

The implementation style is similar to LibJS - the JS engine used in SerenityOS and the Ladybird browser which I worked on before - in various aspects, most notably the desire to stay very close to spec. Development is still at an early stage and the engine's usefulness thus limited. While there are various things that already work well, there's an equal amount of things that don't :^)

Please refrain from filing issues for missing features - many are missing! Similarly, please get in touch before starting to work on something larger than a bug fix.

Further reading:

Build

Dependencies managed through build.zig.zon will be installed automatically when building for the first time.

To build and run the Kiesel CLI:

zig build run

NOTE: Kiesel targets the master branch of Zig. This means that the build breaks semi-regularly, which I will usually fix as soon as I notice.

Build Options

These can be set by passing -D<name>=<value> to zig build.

Name Default Description
enable-annex-b true Enables support for ECMA-262 Annex B language features.
enable-intl true Enables support for ECMA-402 (Intl), which depends on cargo being available for the ICU4X library.
enable-legacy true Enables support for legacy language features

Usage

Usage: kiesel [options] [file]

Options:
  -c, --command                            Run the given code instead of reading from a file
      --disable-gc                         Disable garbage collection
  -m, --module                             Run code as a module instead of a script
      --print-ast                          Print the parsed AST
      --print-bytecode                     Print the generated bytecode
      --print-gc-warnings                  Print GC warnings, e.g. OOM
      --print-promise-rejection-warnings   Print promise rejection warnings
  -p, --print-result                       Print the evaluated result
  -v, --version                            Print version information and exit
  -h, --help                               Print help text and exit