llparse-frontend

raw JSON →
3.0.0 verified Fri May 01 auth: no javascript

Frontend for the LLParse compiler, version 3.0.0. This package provides the parsing and AST generation logic for llparse, an LL(1) parser generator for Node.js and browsers. It is part of a larger ecosystem that includes llparse-backend and llparse-util. The library is written in TypeScript and ships type definitions. It is actively maintained but still considered WIP. Key differentiators: designed for performance and low memory footprint, suitable for building efficient parsers. Released under MIT License.

error Error [ERR_REQUIRE_ESM]: require() of ES Module
cause Using CommonJS require() with ESM-only package.
fix
Use dynamic import() or switch to ES modules in your project.
error TypeError: frontend.parse is not a function
cause Frontend class not properly instantiated or import error.
fix
Ensure you are using the named export Frontend: import { Frontend } from 'llparse-frontend';
error SyntaxError: Unexpected token
cause Provided code string has invalid syntax for the parser.
fix
Check the syntax of the input code; ensure it matches the expected grammar.
breaking ESM-only since version 3.0.0. CommonJS require() will not work.
fix Use ES module imports (import ... from 'llparse-frontend') or downgrade to v2.x.
gotcha The library is WIP and the API may change without major version bump before reaching 4.0.0.
fix Pin to exact version and test upgrades thoroughly.
gotcha TypeScript types are provided but may not be fully accurate; always check the actual runtime behavior.
fix Verify types against runtime, especially for complex grammars.
npm install llparse-frontend
yarn add llparse-frontend
pnpm add llparse-frontend

Create a Frontend instance, parse an arithmetic expression, and log the AST.

import { Frontend } from 'llparse-frontend';

const frontend = new Frontend();
const code = '1 + 2 * 3';
const ast = frontend.parse(code);
console.log(ast);