/esmeta

ECMAScript Specification (ECMA-262) Metalanguage

Primary LanguageScalaBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

ESMeta

ESMeta is an ECMAScript Specification Metalanguage. This framework extracts a mechanized specification from a given version of ECMAScript specification (ECMA-262) and automatically generates language-based tools.


Publications

Details of the ESMeta are available in our papers:


PLDI 2022 Tutorial

Title: Filling the gap between the JavaScript language specification and tools using the JISET family


Installation Guide

We explain how to install ESMeta with necessary environment settings from the scratch. Our framework is developed in Scala, which works on JDK 8+, including GraalVM. Before installation, please install JDK 8+ and sbt, an interactive build tool for Scala.

Download ESMeta

$ git clone https://github.com/es-meta/esmeta.git

Environment Setting

Insert the following commands to ~/.bashrc (or ~/.zshrc):

# for ESMeta
export ESMETA_HOME="<path to ESMeta>" # IMPORTANT!!!
export PATH="$ESMETA_HOME/bin:$PATH" # for executables `esmeta` and etc.
source $ESMETA_HOME/.completion # for autocompletion

The <path to ESMeta> should be the absolute path of ESMeta repository.

Installation of ESMeta using sbt

$ cd esmeta && git submodule update --init && sbt assembly

Basic Commands

You can run this framework with the following command:

$ esmeta <command> <option>*

with the following commands:

  • help shows the help message.
  • extract extracts specification model from ECMA-262 (ecma262/spec.html).
  • compile compiles a specification to an IR program.
  • build-cfg builds a control-flow graph (CFG) from an IR program.
  • parse parses a JavaScript file.
  • eval evaluates a JavaScript file.
  • web starts a web server for interactive execution.

and global options:

  • -silent does not show final results.
  • -debug turns on the debug mode.
  • -log turns on the logging mode.
  • -time displays the duration time.

Future Plans

Conformance Test Synthesizer for ECMAScript

We will import the conformance test synthesizer we developed in JEST.

Type Analyzer for ECMA-262

We will import the type analyzer for ECMA-262 we developed JSTAR.

Meta-Level Static Analyzer for ECMAScript

We will import the meta-level static analyzer for ECMAScript we developed JSAVER.

ECMAScript Double Debugger

ECMAScript Double Debugger extends the JavaScript interpreter in ESMeta to help you understand how a JavaScript Program runs according to ECMA-262. Currently, it is in an alpha stage and supports only basic features such as:

  • Step-by-step execution of ECMAScript
  • Breakpoints by abstract algorithm names in ECMAScript
  • Visualization of states like a call stack, an environment, and a heap of ECMAScript
  • Line-by-line execution of JavaScript

You can start it with the following instructions:

# turn on server of the double debugger
$ esmeta web

# install the client-side application using NPM
$ git clone https://github.com/es-meta/esmeta-debugger-client.git
$ cd esmeta-debugger-client
$ npm i

# turn on the client-side application
$ npm start

A short introduction video is also available.

debugger

We will enhance it with the following features:

  • Add more debugger features:
    • Show a JavaScript state by refining an ECMAScript state.
    • Record timestamps during execution for resume & suspend steps (especially for Generator).
    • ...
  • Show relevant Test262 tests for each algorithm step in the specification viewer.
  • Show the type of each variable using the type analysis result of JSTAR.
  • Live-edit of ecma262/spec.html in the specification viewer.