Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hsiaosiyuan0/naive
Learn JavaScript the hard way π€―
https://github.com/hsiaosiyuan0/naive
Last synced: 2 months ago
JSON representation
Learn JavaScript the hard way π€―
- Host: GitHub
- URL: https://github.com/hsiaosiyuan0/naive
- Owner: hsiaosiyuan0
- Created: 2019-06-21T12:24:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T02:34:25.000Z (over 5 years ago)
- Last Synced: 2024-08-03T09:12:38.934Z (6 months ago)
- Language: Rust
- Homepage:
- Size: 149 KB
- Stars: 215
- Watchers: 9
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-star - naive
README
# Naive
This is a naive JavaScript engine implemented in pure Rust to improve my JavaScript knowledge.
[![asciicast](https://asciinema.org/a/NSyybvRaFimC4OLIDtarKJkII.svg)](https://asciinema.org/a/NSyybvRaFimC4OLIDtarKJkII)
## Checklist
### Frontend
* [x] Lexer
* [x] Recursive descent parser with [Operator Precedence Algorithm](https://en.wikipedia.org/wiki/Operator-precedence_parser) to optimize operators parsing
* [x] Generates abstract syntax tree on basis of [ESTree](https://github.com/estree/estree)### Intermediate
* [x] Generates bytecode(opcode) from AST
* [ ] Bytecode analysis
* [ ] Optimizes bytecode according to the analysis result### VM
* [x] Reference-counting GC with Mark-and-Sweep to deal with the reference cycle
* [x] Common Flow Control Statements(if-else, for, while, do-while)
* [x] Closure
* [x] Mathematical Operations
* [x] Function Invocation
* [x] Logical Operations
* [ ] Bitwise Operations
* [x] Object Literal
* [x] New Expression
* [x] Member Access Expression
* [ ] For-in Statement
* [ ] Switch Case Statement
* [ ] Try-catch Statement
* [ ] Debug## How to run
Thanks to the Rust development infrastructure, run this engine from source is very easy, just:
```
$ cargo build
$ cargo run your-script.js
```It's still in development, after itβs completed Iβd like to write a series of posts to describe how to build a JavaScript engine from scratch, stay tuned.
Feel free to leave any response by submitting a issue. Star/Fork to subscribe its updates is welcome.