Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a huge project that is using YACC and I would need to fix a bug in it.

I might ask someone else who wrote that to fix it but I'm interested in how compilers work. Does it make sense to learn YACC nowadays? It was told me that it's old and obsolete. I would love to understand how compilers/llvm and other stuff like those work... what about YACC?

share|improve this question

closed as primarily opinion-based by gnat, MichaelT, Kilian Foth, Bart van Ingen Schenau, World Engineer Jul 23 '13 at 14:03

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

5  
If your project includes a DSL (Domain-Specific Language), you should learn about parsing, grammars, ASTs and all the funky stuff where the usual introduction is the Dragon Book. Then you can turn to the tools (yacc, bison, haskell-based compiler compilers etc.) –  Deer Hunter Jul 22 '13 at 13:52
1  
@jozefg - compiler compilers like Parsec (legacy.cs.uu.nl/daan/parsec.html). –  Deer Hunter Jul 22 '13 at 14:14
2  
@DeerHunter Ah, I'd just never heard the term compiler-compiler before. Parsec is more commonly called a parse-combinator library –  jozefg Jul 22 '13 at 14:40
1  
YACC is based on foundational research on formal languages so, even if the tool can be improved and alternative tools / methods can be proposed, it can hardly become "obsolete" because formal languages will continue to work in the same way in the future. –  Giorgio Jul 22 '13 at 16:09
1  
@jozefg: YACC stands for "Yet Another Compiler Compiler." –  Blrfl Jul 22 '13 at 16:24

2 Answers 2

up vote 5 down vote accepted

YACC helps you with one step of the pipeline: creating a parser for a specific grammar. There are lots of other ways to do that step. There are a ton of parser generators available, or you can manually write your own parser. Depending on your requirements, there are many technical reasons to consider YACC to be obsolete, not the least of which is its limited choice of output languages.

However, it is nowhere near obsolete as a pedagogical tool. You'll need to learn the fundamentals of parsers and grammars no matter what parser you use, and you can learn those just as easily using YACC as with anything else. The knowledge translates very easily. I learned YACC in school, but picked up ANTLR with very little effort.

Also consider that it's very likely your bug isn't even in the parser. Usually most parser bugs get ironed out very early in the project, because they have a tendency to produce spectacular failures. The more subtle errors tend to be in the layers downstream of the parser, which have nothing to do with YACC.

share|improve this answer

I don't think YACC is obsolete. In a sense it is obsoleted by bison, the GNU implementation, but that is backward compatible with the original version.

The big compilers appear to have manually written parsers, I suppose mainly because they need better diagnostics in case of parse errors than what the generic parser generator provides. But many tools with smaller domain specific language use bison (llvm suite build-depends on bison, so it apparently has some, though clang has manually written parser), because it gets the job done quickly and in more maintainable way.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.