Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/delskayn/toyjs
A toy javascript interpreter written in rust. Very much under development.
https://github.com/delskayn/toyjs
ecmascript interpreter javascript javascript-engine javascript-interpreter rust
Last synced: 3 months ago
JSON representation
A toy javascript interpreter written in rust. Very much under development.
- Host: GitHub
- URL: https://github.com/delskayn/toyjs
- Owner: DelSkayn
- Created: 2020-04-05T17:06:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-29T16:23:23.000Z (4 months ago)
- Last Synced: 2024-10-14T20:34:20.359Z (4 months ago)
- Topics: ecmascript, interpreter, javascript, javascript-engine, javascript-interpreter, rust
- Language: Rust
- Homepage:
- Size: 9.72 MB
- Stars: 31
- Watchers: 2
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Toyjs javascript interpreter.
This repository contains the code of a toy javascript interpreter.
Built for experimentation with building dynamic languages.This interpreter is very much under development and lacks support for a large part of the
javascript language.You can play around with an previous version of the interpreter in your browser [here](https://delskayn.github.io/toyjs/)
## Features
- Register based bytecode VM
- Handwritten parser.
- Traditional Lexer to Parser to ast to compiler to bytecode design.
- Almost safe sweep and trace GC
- Minimal dependencies.## Current State
The engine is currently undergoing a rewrite and is in a non-functional state.
But you can play around with the currently functional parts of the interpreter.
## Running the interpreter
The VM is currently very bare-bones, with only a very small number of instructions implemented.
A simple example for the VM can ran with```sh
cargo run --example vm
```All examples take either a file name or assume a script will be piped into stdin.
The interpreter has varies tools for printing data-structures and generated source information.
For printing a AST you can use
```sh
cargo run --example parse
```
The lexer can similarly be run on code with
```sh
cargo run --example lex
```A overview of symbol information produced by the compiler can be printed with
```sh
cargo run --example resolve
```A script can be compiled and the compiled instructions can be dumped with
```sh
cargo run --example compile
```