Skip to content

moo-w/tiny-compiler

Repository files navigation

Tiny Compiler

Learn the-super-tiny-compiler.

  • tokenizer
  • parser
  • traverser
  • transformer
  • codegen
  • compiler

Test it out

Installation

npm install @moozon/tiny-compiler

Compiler

import { compiler } from '@moozon/tiny-compiler'

console.log(
  /** 
   * should output:
   * "add(2, subtract(4, 2));"
   */
  compiler('(add 2 (subtract 4 2))')
)

console.log(
  /** 
   * should output:
   * "add(2, subtract(4, 2));
   * add(2, subtract(4, 2));"
   */
  compiler('(add 2 (subtract 4 2))(add 2 (subtract 4 2))')
)

Other APIs

import {
  codegen,
  parser,
  tokenizer,
  transformer,
  traverser,
} from '@moozon/tiny-compiler'

// checkout test files
// ...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published