Welcome to the Janglim manual
Janglim is an LR/LALR parser-generator engine for .NET.
Sounds hard, right?
That's okay.
This manual assumes you don't know a single one of those scary words, and unpacks everything slowly, from the very beginning.
Who is this manual for?
It's totally fine if you have no idea what a parser is or how a compiler works.
This manual starts from "why do we even need this" and explains it step by step, in the simplest words possible.
So by the time you finish reading, two things will stay with you.
- The concept of parsing itself โ knowledge you'll use for the rest of your life, no matter which parser you end up using
- The tool called Janglim โ and (if you want) even how it's built in code on the inside
This manual has two tracks
To keep it from being overwhelming, we split it into two courses: Basics / Advanced.
๐ข Basics track โ just the concepts, nice and easy.
No formulas, no code, just the concept and the intuition.
Each page has:
| Step | What |
|---|---|
| โ Why you need it | What breaks without it (starting from the problem) |
| โก What it does | The concept itself + a small example |
| โข See it in the playground | Run it yourself in the browser and check |
๐ต Advanced track โ formulas + code.
We take the same concept and organize it into a formula (algorithm) that works for any grammar, and then look at how it's implemented in the Janglim code.
At the end of each concept in the Basics track, I'll leave a "โ to Advanced" link.
If this is your first time, just read straight through the Basics track.
The Advanced stuff is fine to look at later, whenever you get curious. ๐
We go all the way with a single example
Across most of the manual we keep using this one tiny grammar โ it's a little arithmetic expression with addition and multiplication.
Expr : Expr '+' Term | Term ; Term : Term '*' Factor | Factor ; Factor : '(' Expr ')' | id ; id := "[a-zA-Z]+" ;
And we keep parsing this input: a + a * a
Every chapter adds one more layer of understanding to this same example.
Now and then, when a concept can't be shown with this grammar (ฮต, conflicts, and the like), we bring in a small auxiliary grammar and show it in full right there.
(We'll take apart how to read this grammar slowly, together, the first time it shows up, so there's no need to worry about it in advance.)
So, shall we get started?
- ๐ Getting Started โ install it and run your first parse in 5 lines.
- ๐ฟ Live playground โ right in the browser, no install needed.
Note: Janglim is still an early preview (
0.2.0-preview).
The public API may change during0.x.
Acknowledgments
I'd like to express my deep gratitude to those who helped so much in building the skeleton of this project.
- Seman Oh and Yunsik Son, authors of Introduction to Compilers โ I learned the fundamentals of compilers from this book.
- Actipro Software โ inspired by the way they specify LL parsers, I completed the grammar-definition structure that writes EBNF as code.
- Claude and Codex, my assistants and contributors โ they read through my code with me and organized it into this manual, and they're colleagues who will keep helping me with many things going forward.
Thank you, sincerely. ๐