Skip to content
ํ”„๋กœ์ ํŠธ

์†Œ๊ฐœ

Learn JavaScript the hard way ๐Ÿคฏ

ํ•™์Šต ๋ฐ ๊ต์œก

์ด ์ˆ˜์น˜๋ฅผ ์ธก์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

์ธก์ •๋œ ์Šคํƒ€ ์ฆ๊ฐ€

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
๊ธฐ๋ก ์ˆ˜์ง‘ ์ค‘

์„œ๋กœ ๊ฒน์น˜๋Š” ๊ธฐ๊ฐ„์˜ ์ˆœ์ฆ๊ฐ€๋Ÿ‰์ด๋ฉฐ ์ผ๋ณ„ ํ•ฉ๊ณ„๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ธก์ •๊ฐ’์ด ์—†์œผ๋ฉด ๋น„์›Œ ๋‘ก๋‹ˆ๋‹ค. ์Šคํƒ€๋Š” ๊ด€์‹ฌ๋„๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ ํ’ˆ์งˆ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

README.md

Original

Naive

This is a naive JavaScript engine implemented in pure Rust to improve my JavaScript knowledge.

asciicast

Checklist

Frontend

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.

๊ด€๋ จ ํ”„๋กœ์ ํŠธ ์‚ดํŽด๋ณด๊ธฐ

๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ