Implement your own runtime system

Disclaimer

What is so-called runtime?

> node main.js
  • Understand JavaScript syntax
  • Execute your JavaScript program
  • Provide native APIs for your JavaScript program to do things like File I/O
  • Manage the memory consumed by your JavaScript program

Our Goal

By tiny

  1. Primitive types: number, string, bool.
  2. Compound types: array with `.map` and `.reduce`.
  3. Expressions: case/switch, function call, operators.
  4. No statements inside the Function, except for variable declaration.
  5. Lazy by default (realized by returning Functions, instead of values).
  6. Pluggable “context” as native modules and can use `require` syntax to consume them.
  7. (Optional) File-based module system (still support `import`).

By fork-able

You can experiment with this runtime whatever you like!

By understandable

You can see what’s going on when your program is being executed.

Our Architecture

runtime architecture

Guest Language

Host Language

Parser

Interpreter

Just-In-Time compiler (JIT)

Heap

Allocator

Garbage Collector

Runtime APIs

--

--

--

Frontend Developer @Mercari, who does sports and philosophy.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Importance of Version Control and How You Can Utilize Git

Make your services better with Einstein Prediction Builder and Einstein Analytics

Netdata: The Easiest Way to Monitor Your Kubernetes Cluster

Building HEYHEY — Scaffolding a Modern Web App In 2022

Launching Milligram v1.4

Learning to Code: Day 1

What to Test When You’re Testing

Universal Acceptance and its impact

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Paipo Tang

Paipo Tang

Frontend Developer @Mercari, who does sports and philosophy.

More from Medium

Challenge — We Need To Lint Protos Easily

Solace Selector

How to configure Dependabot with Gradle