Paper: "OMeta: an Object-Oriented Language for Pattern Matching" Website PhD dissertation or here
API on Github | npm | Source or Source | Dissertation
Globally for use as a transpiler tool: $ [sudo] npm install ometajs -g
... or locally for programmatic use: $ cd /path/to/your/project; npm install ometajs
$ ometajs2js --help
Usage:
ometajs2js [OPTIONS] [ARGS]
Options:
-h, --help : Help
-v, --version : Version
-i INPUT, --input=INPUT : Input file (default: stdin)
-o OUTPUT, --output=OUTPUT : Output file (default: stdout)
--root=ROOT : Path to root module (default: ometajs)
ometajs2js will take input *.ometajs file and produce a CommonJS- compatible javascript file.
You may also require('*.ometajs') files directly without compilation. (OMetaJS is patching require.extensions as CoffeeScript does).
var ometajs = require('ometajs');
var ast = ometajs.grammars.BSJSParser.matchAll('var x = 1', 'topLevel'),
code = ometajs.grammars.BSJSTranslator.matchAll([ast], 'trans');
ometa Simple {
top = [#simple] -> 'ok'
}
Last modified 16 December 2024