Skip to content

Manik2375/the-super-tiny-compiler-TS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The super tiny compiler in TypeScript!

A TypeScript implementation of a minimal compiler that transforms LISP-style function calls into C syntax.

What it does

Transforms this:

(add 2 (subtract 4 2))

Into this:

add(2, subtract(4, 2));

Features

  • Tokenizer: Lexical analysis of input
  • Parser: Builds Abstract Syntax Tree (AST)
  • Transformer: Converts LISP AST to C AST
  • Code Generator: Outputs C code
  • Full TypeScript: Type-safe implementation with proper interfaces

Usage

# Install dependencies
npm install

# Build the project
npm run build

# Run the example
npm run start

Attribution

This project is a TypeScript adaptation of The Super Tiny Compiler by @jamiebuilds

Changes Made

  • Converted from JavaScript to TypeScript
  • Added comprehensive type definitions
  • Separated types into dedicated module
  • Added ES module support

License

This derivative work is also licensed under CC BY 4.0.

Contributing

This is a learning project. Feel free to fork and experiment!

About

The super tiny compiler now in Typescript!

Resources

Stars

Watchers

Forks

Contributors