Repository navigation
Replies: 1 comment 5 replies
ISPA uses its own grammar format. It's not a drop-in replacement for ANTLR4. Instead of devising your own EBNF syntax, I would recommend using a restricted .g4 format and resisting the temptation to add non-portable features like labels, lookahead/lookback, and action code. You can place disambiguation, AST construction, semantics, etc., elsewhere and specify them in a target- or non-target-specific language. https://github.com/antlr/grammars-v4 has 460 grammars, the largest known corpus of grammars. While some grammars include non-portable features, we will try to move those features elsewhere later. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi, I've been working a lot on my own parser generator. ANTLR was the inspiration, though it's substantially different now. It's stable enough that ISPA's own grammar is bootstrapped with it, with Python embedded. It can also parse and process Python alongside the grammar itself, though that part isn't finished yet.
What's the same
What's different
Some more features
The part I cared about most
Writing semantic actions and failure handling directly in the grammar was the feature I wanted more than anything else. Instead of dropping into target-language callback files or writing a visitor pass after the parser's already built, you write the logic — including what should happen when something fails — right next to the rule it belongs to, in Python subset that lowers to whichever target language you're generating. And when you don't want to hand-write recovery, ISPA can generate a reasonable one for you. That combination — in-grammar actions plus in-grammar failure handling, both statically compiled — is the thing I built the rest of the project around.
Why I'm posting this
Mostly because a tool like this is only as good as the grammars it's been thrown at, and so far that's mostly been mine. I'd like ISPA to get real adoption, and the most useful thing anyone reading this could do is take it for a spin on a grammar you actually care about and tell me where it breaks, where the generated code surprised you, or where the docs left you guessing.
Feedback
If you've got a few minutes: what would you change about any of this? What's missing that you'd expect from a parser generator at this point, and what here looks like a mistake from the outside? I'd rather hear it now than after I've built more on top of it.
https://github.com/Sinfolke/ispa-parser-generator
All reactions