Skip to main content
Deno 2 is finally here 🎉️
Learn more

🤖 TinyCompTS

A tiny Javascript/Typescript compiler written in vanilla Typescript as a hobby project.

📖 Guide

Define an attribute grammar

Create an object that implements AttributeGrammar:

  1. Define a lexical ruleset by creating an object that implements LexicalRuleset
  2. Define a syntax ruleset by creating an object that implements SyntaxRuleset
  3. Define a semantic ruleset by creating an object that implements SemanticRuleset

Configure TinyComp

  1. Create an object that implements TinyCompOptions
  2. Create an instance of TinyComp using the AttributeGrammar and TinyCompOptions object
  3. Use compiler.compile(input: string) to compile input

📔 Example

→ see example.ts

Import

🦖 Denoland

import TinyComp, {AttributeGrammar, LexicalRuleset, SemanticRuleset, SyntaxRuleset, TinyCompOptions} 
    from "https://deno.land/x/tiny_comp_ts@v1.1.1/ts/TinyComp.ts";

❤️ Npm

Coming soon?

🧪 Just test

  1. Install the JS/TS runtime Deno
  2. Clone this repo & navigate into the root directory
  3. deno run ./example.ts