JavaScript in JavaScript interpreter.

What & why?

MetaES is a building block for other libraries and tools.
It was created to speed up applications development.

# Main features

1. Writen in JavaScript

MetaES is a metacircular interpreter. It means it's written JavaScript.

To take most of MetaES, you'll have to learn how it works, otherwise you can just use tools written by others without even being aware of MetaES.

2. Integrates with your application

No matter what app you're building and when it is run:

  • in browser,
  • in nodejs,
  • in extensions,
  • in any other environment or custom ECMAScript interpreter,

you can benefit from MetaES. It flattens many of your ad-hoc built abstractions, and allows to exchange data between MetaES script and your app.

3. Excellent error handling and introspection

MetaES is an interpreter, meaning errors and error handling are intristic part of whole project. It's also true for any other interpter following ECMAScript standard.

If you mix your application code with MetaES, your code will reliable to the degree MetaES is.

# Built on standards

1. ECMAScript

MetaES was written using JavaScript language, but MetaES follows ECMAScript spec to implement features.
It doesn't implement full spec yet, when trying to use unsupported part, it will throw an error with information.

2. Send data with JSON

If you want to communicate from browser to application running on server, use MetaES messages to communicate. They're JSON based, meaning you can use HTTP (or any other) protocol to transfer data.

It looks a bit like RPC, but it's more like sending code to remote context. It's distributed interpter.

3. Bring your own MetaES implementation

MetaES core is small and simple. If you can't or don't want to choose JavaScript platform for your project, implement MetaES subset yourself and communicate with others using MetaES messages.

# Show me an example

Let's get to the working example:

  • It's JavaScript micro IDE,
  • Uses Vanillin,
  • Editor displays code which you can edit and rerun (all previous state will be destroyed),
  • Side panels of editor display immediate values of AST nodes (right) and errors (left).
  • Unevaluated code (or not marked as evaluated because of IDE unifinshed logic) is rendered as semi-transparent
"Line "+(item.location.loc.start.line-1) + ": " + (item.message || item.value.message)
let array = [7, 5, 2, 4, 3, 9];

Object.keys(window)
  .slice(0, 5)
  .filter(item=>item.indexOf('b')>=0);
const results = [];
for(let item of Object.keys(window).slice(0, 5)){
  results.push(item);
}
function bubbleSort(arr){
  var len = arr.length;
  for (var i = len-1; i>=0; i--){
    for(var j = 1; j<=i; j++){
      if(arr[j-1]>arr[j]){
          var temp = arr[j-1];
          arr[j-1] = arr[j];
          arr[j] = temp;
        }
    }
  }
  return arr;
}
bubbleSort(array); //[2, 3, 4, 5, 7, 9]

toOneLineString(item.value);item.e.type + ": "+typeof item.value
  • Flame chart below represents chart with time on X axis of AST and nodes visits stack on Y axis,
  • It highlights connected node on graph when cursor moves in an editor,
  • It's rendered interchangebly alongside with script execution: