Skip to content

mras0/mjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mjs

Introduction

mjs is an interpreter for the ECMAScript (a.k.a. Javascript) 1st , 3rd and 5(.1)th editions written in C++17. It was written as a hobby project for the purpose of gaining a better understanding of how Javascript actually works. As such, it neither strives to be fast, secure nor particularly beautiful. In fact, some things are downright terribly implemented; also no real programs were actually tested.

All ES1, ES3 and ES5.1 features should be implemented (to some degree...), but conformance is always work in progress.

See the TODO file some of the known pain points and the progress on passing the ES5 Conformance Suite tests.

Building

You need a modern C++ compiler that supports C++17 and CMake 3.7 or later. It has currently been tested with the following compilers:

  • Visual C++ 2017 15.9.6 on Windows 10
  • GCC 8.2.0 (x64 distribution from Stephan T. Lavavej) on Windows 10
  • GCC 8.2.0 (on x64 Linux, Debian testing as of October 2018)
  • Clang 7.0.0 (on Windows 10 and x64 Linux)

To run the tests build the check target.

The interpreter is built in the src directory. It accepts a Javascript file on the command line or starts in REPL mode if no argument is given. The ECMAScript version can be chosen by supplying it as a command line argument (e.g. mjs -es1).

These steps should work for most people:

mkdir build
cd build
cmake .. # Here you may want to use e.g. CXX=g++-8 cmake ..
cmake --build .
cmake --build . --target check

Several debugging features can also be enabled. Use your favorite CMake GUI to view and toggle them (they are all off by default).

Documentation

The project is currently light on the documentation front, but here is what's available so far:

Support

Forget about it :) Feel free to raise an issue on GitHub, but don't expect anything to come of it.

About

ECMAScript Interpreter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages