Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"I went back to University for another graduate degree in 1984, and I was suprised to hear the professor that taught the compiler class say that everyone should be using lex and yacc for any compiler development. By then, in the real world, people had discovered the much more meaningful error messages were possible with LL or reecursive descent (i.e., to down) parsing."

The error messages complaint is the one I always see. I rarely see other, specific complaints.

Question: Is this "error messages" complaint referring to error messages for lex, yacc or both. Does the complaint apply evenly to both programs. As a flex user, generally, I rarely if ever see error messages.

I like flex because it does not require as much memory as the alternatives. Ideally, I want scanners to perform roughly same from computer to computer and from input to input, irrespective of the amount of memory available or the size of the input. I like UNIX utilties that read files line by line.



It is not the error messages produced by yacc when you have a bug in your parser. It is the error messages produced by the compiler when the input program does not conform to the language specification. More useful error messages let users more rapidly diagnose the error in their program and fix it.


This means that the "error messages" complaint does not apply to someone who is only using lex and not yacc. Thus, when someone complains about "lex and yacc" and error messages, they are complaining about yacc. I often use flex without using yacc. I am not using it in compiler construction. Thus, according to UncleMeat's comment the "error message" complaints do not apply to flex if used without yacc, i.e,, if used for purposes other than compiler construction..


Complaining about error messages when using LALR is one thing. Constantly singling out "lex and yacc" (maybe because of some bad experience in a compilers course) is another. Yacc is not the first implementation of LALR, there are others, e.g., the lemon parser used in the SQLite Project. There is nothing LALR-specific about lex.


This isn't about these tools in the abstract. This thread is about various compiler architectures.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: