project screenshot 1
project screenshot 2
project screenshot 3

Gremlins

A tiny (under 20kb) compiler for a TypeScript-inspired language that compiles to EVM bytecode for querying blockchain data.

Gremlins

Created At

ETHGlobal New York

Project Description

A simple compiler TypeScript-inspired language that compiles to EVM bytecode for querying blockchain data.

The bison grammar is compiled using Jison to create the parser, which generates the Abstract Syntax Tree.

Code generation uses a simple visitor and ASM builder.


The ASM Builder still has a lot of work and will help simplify this project, as the amount of hand-written, low-level EVM byte code required for this proved to be too much for me to complete this project. :)

The ASM Building however, will be the most useful part of this project and will help make future languages easier to during codegen. It has a higher-level interface similar to Yul, except is a JavaScript class that constructs the EVM tree while creating the program.

How it's Made

The only technologies are really just Jison (a JavaScript variant of Bison) to construct the compiler using a standard grammar file.

The grammar file is based largely on the C-grammar for its precedent specification of expressions, with extensions for Solidity Interfaces and TypeScript-style types.

The docs in the GitHub repo contain more information about the runtime and calling conventions.

background image mobile

Join the mailing list

Get the latest news and updates