项目
在 GitHub 查看
hsiaosiyuan0/naive
关于
Learn JavaScript the hard way 🤯
学习与教育实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Naive
This is a naive JavaScript engine implemented in pure Rust to improve my JavaScript knowledge.
Checklist
Frontend
- Lexer
- Recursive descent parser with Operator Precedence Algorithm to optimize operators parsing
- Generates abstract syntax tree on basis of ESTree
Intermediate
- Generates bytecode(opcode) from AST
- Bytecode analysis
- Optimizes bytecode according to the analysis result
VM
- Reference-counting GC with Mark-and-Sweep to deal with the reference cycle
- Common Flow Control Statements(if-else, for, while, do-while)
- Closure
- Mathematical Operations
- Function Invocation
- Logical Operations
- Bitwise Operations
- Object Literal
- New Expression
- 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.
探索相关项目
加载中…