3 ms·
"ANTLR instead is more actively developed. It has been re-written from scratch a few times during the years, so the code has is of good quality." ... rewrites
by nottorp 7y ago
"ANTLR instead is more actively developed. It has been re-written from scratch a few times during the years, so the code has is of good quality."
... rewrites improve code quality ... right ... right???
- iandinwoodie 7y agoNow _I_ can read it, so it _must_ be better!
- cmrdporcupine 7y agoI first learned Antlr way back about 20 years ago and found it fairly impressive. So when I go to write a new parser or lexer I always go take a look again... But every time I take a new look at Antlr there's a huge amount of issues related to the fact that they have a huge new rewrite deprecating old versions while the new version is not ready: entirely new ways of doing things with missing documentation and examples, incomplete or missing language backends, and missing packaging for various Linux distributions. What I get from it is: Antlr is a very powerful project... if you're in the Java ecosystem and if you're willing to use old no longer supported versions. Otherwise, questionable choice.
- tonyarkles 7y agoYour experience mirrors my experience quite a bit. I remember a few years ago playing with ANTLR precisely as an alternative to flex/bison for a project I was working on. Just recently I had an embedded project (quite resource constrained, like 4kB of RAM) that needed to parse some data coming in a serial port, and I thought “hey, I should look at ANTLR again”. I fire it up, play around a bit, and did a calculator example or something like that. The next step, I figure, is to get it to generate some C code so I can test it on the device. Turns out ANTLR4 has dropped the C backend entirely! C++ is, currently, a no-go for the project, so... I guess I’m out of luck there. Pleasantly, in a discussion with a friend, he asked the silly question: “couldn’t you parse those strings with sscanf()?”. I blinked in disbelief, wrote the tiniest parser to split the input on newlines, and sscanf() did the trick.
- JoeAltmaier 7y agoYeah sscanf can do quite a bit. But it doesn't have any informative error messages, can't recover (skip to the next semicolon or whatever), doesn't keep a symbol table, can't do any parsing more complex than "the next line looks exactly like this pattern" etc. So after years of rolling my own, I finally decided I would never do that again. All the off-by-one errors, difficult-to-diagnose failures and endless fiddling is out of my life now. I just use a parser tool.
- techslave 7y agois that a copypasta error or verbatim? that statement itself could use a rewrite. irony at its best
- ftomassetti 7y agoRewriting perhaps not, but being able to fix the ebnf-flavor used to make it more powerful it is a great thing. If you have to stay 100% compatible with all the mistakes accumulated in 30 years you are tied