Getting Started
Get started with Galore parser toolkit
Installation
Install Galore using npm or yarn:
npm install galore
# or
yarn add galore
Quick Start
Here's a simple example to get you started:
import * as G from "galore";
// Define a grammar for simple arithmetic
const grammar = `
Expr -> Expr "+" Term | Term
Term -> Term "*" Factor | Factor
Factor -> "(" Expr ")" | NUMBER
`;
// Create an LALR parser
const parser = G.newParser(grammar, { type: "lalr" });
// Parse an expression
const tree = parser.parse("1 + 2 * 3");
console.log(tree);