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.
Common errors
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.
Warnings
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.
Install
npm install llparse-frontend yarn add llparse-frontend pnpm add llparse-frontend Imports
- default wrong
const llparseFrontend = require('llparse-frontend')correctimport llparseFrontend from 'llparse-frontend' - Frontend wrong
import Frontend from 'llparse-frontend'correctimport { Frontend } from 'llparse-frontend' - Options wrong
import { Options } from 'llparse-frontend'correctimport type { Options } from 'llparse-frontend'
Quickstart
import { Frontend } from 'llparse-frontend';
const frontend = new Frontend();
const code = '1 + 2 * 3';
const ast = frontend.parse(code);
console.log(ast);