Skip to content

πŸ€– A tiny JS/TS compiler written in vanilla TS.

License

Notifications You must be signed in to change notification settings

AlexW00/TinyCompTS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

62 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– TinyCompTS

A tiny (~ 26kb) Javascript/Typescript compiler written in vanilla Typescript as a hobby project.

🦾 Capabilities

πŸ“– Guide

1. 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

2. 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, {...} from "https://deno.land/x/tiny_comp_ts/ts/TinyComp.ts";

❀️ Npm

npm i tiny-comp

import TinyComp, {...} from "tiny-comp";

πŸ§ͺ Just test

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

Alternatively, run via docker

  1. Clone this repo & navigate into the root directory
  2. docker run -it -v $PWD:/app denoland/deno:1.17.1 run --allow-net /app/example.ts

πŸ‘¨β€πŸ’» Development

Contributing

Feel free to make a pull request if you like. Keep it minimal and efficient.

Codebase diagram:

Visualization of the codebase