lex and yacc: Tools Worth Knowing
The lex, yacc and supporting code was successfully employed to allow the log analysts to process various log curves. To have written the C code to accomplish the lexical analysis and parsing logic would have taken much longer than the four weeks allowed. As it turned out, this code was much easier to create and debug than it was to introduce into the final Motif application, even though it was written as a callback.
In fact, the number of lines of lex (152) and yacc (953) code were far fewer than the number of lines generated by the two (2765). Of course, one could take the time to write much tighter code than these general purpose tools deliver.
Nevertheless, should you be faced with a similar problem, I strongly recommend using lex and yacc. They are powerful, reliable tools worth knowing.
All listings referred to in this article are available by anonymous download in the file ftp://ftp.linuxjournal.com/pub/lj/listings/issue51/2227.tgz.
- Readers' Choice Awards 2013
- Mars Needs Women
- IBM Will Minimize Impact of Future Disasters
- December 2013 Issue of Linux Journal: Readers' Choice
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- Tech Tip: Really Simple HTTP Server with Python
- Linux Systems Administrator
- Senior Perl Developer
- Mixtapes Community
3 hours 7 min ago
- KDE is one true DE
3 hours 42 min ago
- Command Line Shells (Bash, Zsh, etc.) are 2nd place
4 hours 10 min ago
6 hours 5 min ago
- yes it's Jupiter Broadcasting
7 hours 24 min ago
- nice to see PClinuxOS finally
9 hours 58 min ago
- Personally, I am no longer a
10 hours 55 min ago
- It's Jupiter
1 day 1 hour ago
- GIMP is certainly a graphic
1 day 2 hours ago
- Thanks For Your Sharing
1 day 7 hours ago