Live data from Hacker News

Why not to use (f)lex, yacc or bison

tomassetti.me

1–10 of 91 posts

Re: Why not to use (f)lex, yacc or bison

#3

Maybe I was holding it wrong but in my experience ANTLR’s performance (on JVM) was abysmal.

Yeah I can't see your average C/C++ programmer pulling in a parser generator written in Java to get their job done in place of flex/byacc, I suspect most would rather roll their own parser ahead of that. Maybe it happens, but I can't picture it.

Re: Why not to use (f)lex, yacc or bison

#6
Last time I checked ANTLR, it sucked, and after a quick skim now, it still sucks.

- no way to specify operator precedence explicitly (instead, it’s based on ordering of alternatives)

- no explanation of conflicts / ambiguities in the grammar (again, ambiguities are silently resolved based on ordering of alternatives)

- might, or might not, properly handle left recursion (by “handle” I mean, that the parser always halts)

TL;DR: LL parsing is a dead end, don’t use it.

Re: Why not to use (f)lex, yacc or bison

#7
I recollect using lex/bison for writing compiler for COBOL on mainframe using SAS/C to list variable names in COBOL programs (remember Y2K!). Later in life used ANTLR do something fun in Java. Never thought of comparing them. They both have their best part. If you are coming from Lex, Bison world - you will understand the philosophy behind ANTLR. But there is little more learning curve with ANTLR. Felt it is slightly complicated.

Re: Why not to use (f)lex, yacc or bison

#9
I tried to read this article, but unfortunately the lack of grammar was too distracting and I just couldn't get through it.

A lot of these are things that Google Docs or Microsoft Word will notice and ask you to change. I highly recommend using one of those to write (especially if English is not your first language) and trying to understand the suggestions it makes. Your articles will come out much more readable to others.

Re: Why not to use (f)lex, yacc or bison

#10
post #4

Last I checked, the interface between lex and yacc (resp flex and bison) is by mutating static global variables. Is that still the case? It always struck me as exceptionally bad design.

There is, and has been for quite a while an option to change that. Look for reentrant / pure.
Post reply on HN