serkonda7 / miniscript

Minimal selfhosted compiler for a subset of JavaScript in 1k lines of code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Miniscript

Selfhosted source-to-source compiler for a small superset of JavaScript in 1k lines of code.

The prebuilt JS used for bootstrapping is in out/.

Usage

Usage: node cli.js <command|file>

Examples:
   node cli.js foo.ms   Compile the file ´foo.ms´ into ´foo.js´.

Commands:
	self      Recompile the compiler.
	version   Print version information..
	help      Show this message.

Feature Support and Compability

This section is work in progress and doesn't reflect the actual feature set yet!

Try...catch

try {
	// try statements
} catch (exception_var) {
	// catch statements
} finally {
	// finally statements
}

Optional elements:

  • exception_var and its surrounding parentheses, resulting in catch {...}
  • catch block
  • finally block

Imports and Exports

import * as import_name from 'import'

export { foo, bar, baz }

License and Attribution

This project was inspired by mini-js.

All files in this repository are subject to the MIT License.

About

Minimal selfhosted compiler for a subset of JavaScript in 1k lines of code.

License:MIT License


Languages

Language:JavaScript 100.0%