GNU Bison 3.3 released
savannah.gnu.org
savannah.gnu.org
In a thousand years time will archeologists study us through the bugs left behind in Linux 1300.05 and windows (30)95? Do you think there will still be jobs for Cobol programmers?
Sometimes, yes. But it has also happened often to me that an old bug I was trying to fix was simply gone, either because the error mode has gone away, or the feature that the bug related to has been removed.
And this is why groups like the OpenBSD team and the Linux kernel team are so eager to remove support for old hardware. Removing support for the 80386 cleaned up code which no longer had to have special cases to handle opcodes and features the 80386 doesn't have but later x86 processors do.
I know the docs say that additions are welcome, but I'm still in my infancy of working out how to :)
Congrats though! I love it when these tried-and-true tools continue to perform and improve!
https://github.com/golang/gofrontend/blob/master/go/parse.cc https://github.com/golang/gofrontend/blob/master/go/lex.cc
I can't think of a single major tool that uses ANTLR or bison. I say that being a huge ANTLR fan. Parser/lexer generators are really easy to use for DSLs but for real languages and tools, they're too heavyweight and constraining.
suite: stmt ';' stmt {/* ok */}
| one_line_stmt NEWLINE stmt {raise("you need a ';' there buddy");}
| // other rules
;
obviously this won't be useful for every case in general, otherwise why use ';' at all, but in most cases it'll give a helpful error.Some more powerful parsers like Earley Algorithm have much worse error reporting.
It's still handwritten though so your point stands.
Haskell and OCaml are examples of real languages that use parser generators.
GHC: https://github.com/ghc/ghc/blob/master/compiler/parser/Parse...
Ocaml: https://github.com/ocaml/ocaml/blob/trunk/parsing/parser.mly
Now it would only be troubling if the grammar itself is intended to be widely usable across different languages, say JSON or XML. A parser generator really shines because it can generate code to parse this grammar in multiple languages. For programming languages intended to be written by humans, I value things like good error reporting far more.
You can, for example, take Postgres’s SQL syntax parsing “engine” out of Postgres and use it in your own project, because it’s not actually an “engine”, but rather just a Yacc grammar.
You say they are declarative. My experience is admittedly very limited, but I would call them anything but declarative. There are declarative elements, but the actual payload of your code is very, very often imperative. (A lot of this is shaped by the API, imo).
I compare this to parser combinators (like parsec) and PEGs (like luapeg and rust-peg). I find these other options are more naturally side-effect free, both internally and externally.
This isn't true. You basically need to know the entire algorithm Yacc uses to use it. What does someone with limited knowledge of parsing do when Yacc tells them this?
5: reduce/reduce conflict (reduce 3, reduce 4) on c
state 5
B : x y . (3)
E : x y . (4)I didn't say it was a problem.
I think what they said is closer to the truth. I've used flex/bison a few times to create simple languages, and as long as they're parsed correctly, which is quick/easy to roughly check with a REPL (mine were in that form), conflicts can be ignored. Mine worked fine. It was a joy to use - having both flex and bison program windows open, plus bash to run the makefile, I could add a feature and test it within seconds. I'd say I have very limited knowledge of parsing, but read a few flex/bison books, enough to grasp what that message means. It's not necessary to have no conflicts, from what I understand. And it seems you have a more....professional language in mind, like in a commercial situation.
But then again, Yacc/bison isn't very important because it allows etc.... (i.e. that's not the reason it's important)
Pixie (the Renderman renderer) uses two or three bison grammars.
I personally like SQLite's lemon parser generator for my grammar poking arounding when I'm not messing with my C++ Earley parser implementation -- which I can never seem to get working properly with empty rules since the papers on the subject are less than clear.
But I'm probably a bit of a strange one in that I'll spend days getting a random grammar working then drop it for some shiny new thing to play with.