0.1.0 • Published 7 years ago

sysl-parser v0.1.0

Weekly downloads
2
License
Apache-2.0
Repository
-
Last release
7 years ago

Sysl Parser

A parser for Sysl specification files based on Chevrotain.

Usage

Import as a library:

var Parser = require('sysl-parser');

var content = require('fs').readFileSync('path/to/file.sysl', 'utf-8');

var tokens = Parser.lexer.tokenize(content);
var parser = new Parser(tokens);
parser.modelRule();
// The results of the parsing will be properties of the parser instance.

Run from the command line:

npm install -g sysl-parser
sysl-parser path/to/file.sysl

For example:

$ sysl-parse test/fixtures/model_petshop.sysl 
test/fixtures/model_petshop.sysl is a valid Sysl model!
$ sysl-parse test/fixtures/model_invalid.sysl 
test/fixtures/model_invalid.sysl is not a valid Sysl model:
 - [3:15] MismatchedTokenException: Expecting token of type --> Subset <-- but found --> '=' <--

References