Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e0bc87b

Browse files
committedFeb 10, 2024
Update readme
1 parent a43c840 commit e0bc87b

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed
 

‎README.md

+33-24
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Built for experimentation with building dynamic languages.
66
This interpreter is very much under development and lacks support for a large part of the
77
javascript language.
88

9-
You can play around with the interpreter in your browser [here](https://delskayn.github.io/toyjs/)
9+
You can play around with an previous version of the interpreter in your browser [here](https://delskayn.github.io/toyjs/)
1010

1111
## Features
1212
- Register based bytecode VM
@@ -15,33 +15,42 @@ You can play around with the interpreter in your browser [here](https://delskayn
1515
- Almost safe sweep and trace GC
1616
- Minimal dependencies.
1717

18-
## Running
18+
## Current State
1919

20-
In order to run the vm compile the `cli` binary with the following command:
21-
```
22-
cargo build --release --bin cli
23-
```
24-
This will produce a binary in the target directory which can execute javascript scripts as following:
25-
```
26-
cargo run --release --bin cli ./script.js
20+
The engine is currently undergoing a rewrite and is in a non-functional state.
21+
22+
But you can play around with the currently functional parts of the interpreter.
23+
24+
25+
## Running the interpreter
26+
27+
The VM is currently very bare-bones, with only a very small number of instructions implemented.
28+
A simple example for the VM can ran with
29+
30+
```sh
31+
cargo run --example vm
2732
```
2833

29-
Toyjs als implements a bunch of tools for debugging the runtime, like various tools which dump the
30-
intermediate representations of the to be run scripts.
31-
These binaries are:
32-
- `dump_tokens` which dumps all the tokens generated by the lexer.
33-
- `dump_ast` which dumps the generated abstract syntax tree
34-
- `dump_bytecode` which dumps bytecode to be executed by the vm.
35-
- `toyjs_test` a tool to run the `test262` tests on the interpreter
34+
All examples take either a file name or assume a script will be piped into stdin.
35+
36+
The interpreter has varies tools for printing data-structures and generated source information.
3637

37-
# WASM
38-
The interpreter also compiles to wasm!
38+
For printing a AST you can use
39+
```sh
40+
cargo run --example parse
41+
```
42+
The lexer can similarly be run on code with
43+
```sh
44+
cargo run --example lex
45+
```
3946

40-
You can play around with a simple REPL in your browser [here](https://delskayn.github.io/toyjs/).
47+
A overview of symbol information produced by the compiler can be printed with
48+
```sh
49+
cargo run --example resolve
50+
```
4151

42-
## Crates
43-
The toyjs interpreter consists of various crates.
44-
The primary crate is `toyjs` crate in the repository root.
45-
This crate implements a 'safe', high level interface over the various functions of the interpreter, as well as the javascript runtime.
52+
A script can be compiled and the compiled instructions can be dumped with
53+
```sh
54+
cargo run --example compile
55+
```
4656

47-
The implementation of the interpreter itself can be found in the various crates under the `crates` directory.

‎crates/lexer/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ phf = {version = "0.11.1", features = ["macros"]}
1212
token = { version = "0.1.0", path = "../token", package = "toyjs_token" }
1313

1414
[[example]]
15-
name = "lexer"
15+
name = "lex"
File renamed without changes.

0 commit comments

Comments
 (0)
Please sign in to comment.