Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

LavRia

TypeScript LALR(1) Parser Generator

install

requirement: npm

$ mkdir pg
$ cd pg
$ npm init
$ npm install lavriapg --save

sample

$ echo 1+1 | node ./node_modules/lavriapg/dist/sample.js

usage

edit language and run the following code:

// TypeScript
import {language_parser, ParserGenerator} from "lavriapg";
import {readFileSync} from "fs";

const input = readFileSync("/dev/stdin", "utf8") as string;
const language = language_parser.parse(readFileSync("./node_modules/lavriapg/language", "utf8") as string); // set the language file path
const parser = new ParserGenerator(language).getParser();
console.log(parser.parse(input));
// JavaScript(CommonJS)
const pg = require("lavriapg");
const fs = require("fs");
const input = fs.readFileSync("/dev/stdin", "utf8");
const language = pg.language_parser.parse(fs.readFileSync("./node_modules/lavriapg/language", "utf8")); // set the language file path
const parser = new pg.ParserGenerator(language).getParser();
console.log(parser.parse(input));

this program parses input (from stdin) that has the lex and grammar rules defined by language and shows its AST.

language is language file and it expresses itself.

About

LavRia: TypeScript LALR(1) Parser Generator

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.