/es

A JavaScript interpreter from scratch, supporting ES5 syntax.

Primary LanguageC++GNU Affero General Public License v3.0AGPL-3.0

es

A JavaScript interpreter from scratch, supporting ES5 syntax.

Compile and Run

Clone and compile:

$ git clone git@github.com:zhuzilin/es.git
$ cd es
$ g++ es.cc -std=c++17 -I$(PWD) -O2 -Wall -Wextra -Wno-unused-parameter -o bin/es

Run:

$ echo "console.log('hello world!')" > hello_world.js
$ bin/es hello_world.js 
"hello world!"

Test

Use test/*.cc:

cmake -S . -B build
cmake --build build
cd build && ctest; cd ..

Run the quickjs test:

sh quickjs-test.sh 

The quickjs tests pass if there is no output.

Acknowledgement

I've learned a lot from Constellation/iv, V8 and thanks a lot for Annotated ECMAScript 5.1.