lc2-compiler

lemoncase2 parser

Usage no npm install needed!

<script type="module">
  import lc2Compiler from 'https://cdn.skypack.dev/lc2-compiler';
</script>

README

api

This main exported function takes a lc2 code string and
returns an abstract syntax tree

export function parse(input: string, options?: configObject): Object;

This function tries to parse a single expression
Useful for REPL, testing, and parsing mixed-language formats

export function parseAt(input: string, options?: configObject): Object;

How to use parse file

const parseFile = require('lc2-compiler/pre');
parseFile('your code', {sourceFile: 'path/to/your/code'});

Note that sourceFile option is required