-
Notifications
You must be signed in to change notification settings - Fork 456
Description
🌞 Introducing Solar — a Fast, Modern SLR(1) Parser Generator (Jison-style)
Hello Jison community 👋,
I’m excited to introduce Solar — a new parser-generator for JavaScript and TypeScript that complements the Jison ecosystem while focusing on speed, simplicity, and modern tooling.
If you love Jison’s grammar syntax but wish the build and iteration cycle were faster and leaner, Solar might be worth a look.
🔍 What Is Solar?
Solar is a standalone SLR(1) parser generator inspired by Yacc/Bison/Jison that:
- ✅ Uses a familiar Jison-style grammar format (
bnf) or a new s-expression format - ⚡️ Generates parsers up to ~215× faster than Jison in benchmarks
(12,500 ms → ~58 ms for a real-world grammar) - 🧩 Outputs either s-expressions or AST classes, depending on your needs
- 📦 Has zero runtime dependencies
- 🧠 Ships as modern ES2022 + TypeScript with first-class support for Bun, Node.js, and Deno
- 🧰 Is already used in production (as part of another project called Rip, which is like a modern CoffeeScript)
➡️ Repo: https://github.com/shreeve/solar
🎯 Why It Might Interest Jison Users
If you’re already working with Jison, Solar offers:
- Faster grammar iteration: Generation in milliseconds, not seconds.
- Simpler tree representation: Optionally output compact s-expressions for direct compiler pipelines.
- Grammar compatibility: Supports a Jison-compatible “bnf” mode — migrate or experiment without a rewrite.
- Modern toolchain support: Seamlessly works with ESM, TypeScript, and Bun.
- Lexer flexibility: Bring your existing Jison lexers, or plug in your own.
🚀 Quick Start
Install via Bun:
bun add solar-parserOr npm:
npm install solar-parserThen create a simple grammar file:
import { o, Generator } from 'solar-parser';
const grammar = {
mode: 'sexp', // or omit for traditional AST mode
grammar: {
Expression: [
o('NUMBER', '1'),
o('Expression + Expression', '["+", 1, 3]')
]
},
operators: [['left', '+']]
};
const generator = new Generator(grammar);
const parserCode = generator.generate();
// Write parserCode → parser.jsYou can also load a bnf grammar for Jison-style definitions.
⚠️ Notes & Differences
- Solar uses SLR(1) parsing (simpler + faster), not full LALR(1).
Most grammars work fine, but some complex ones may need refactoring. - s-expression output simplifies tree building, but differs from class-based ASTs.
- Ecosystem is newer — so docs and community extensions are still growing.
- Some advanced Jison features (e.g., error recovery hooks) are still under development.
💬 Invitation to the Jison Community
If you’re a Jison user and want:
- 🚀 Faster iteration
- 💡 Simpler output
- 🧰 Modern TypeScript/Bun support
…then give Solar a try!
I’d love to hear how it compares for your grammars — feedback, bug reports, and feature ideas are all welcome. Let’s continue improving JavaScript parser-generation together.
Repository: github.com/shreeve/solar
License: MIT — free for open-source and commercial use.
Thanks for reading, and thanks to the Jison community for inspiring this project!
— Steve Shreeve
https://github.com/shreeve
ps - Yes, I used AI to create this. Sorry for all the emoji's...