Evil, Evil Everywhere (was Re: [oclug] Test Shows 99.99% of
linuxdoctor at yahoo.com
Mon Apr 2 14:06:55 EDT 2001
--- Greg Franks <greg at cr1004769-a.slnt1.on.wave.home.com> wrote:
> Lex(Flex) -- a program for building a lexical analyzer. A lexical
> analyzer is used to convert an input stream into a set of tokens.
> Yacc(Bison) -- "Yet Another Compiler Compiler". Yacc is used to
> produce a parser. The parser is used to validate input against the
> grammar of a language (such as C, or French). Yacc is called Yet
> Another Compiler Compiler because there are lots of such beasts
> around. The Amsterdam Compiler Kit is one that comes to mind right
> now. More work (much more :-) is needed for semantic analysis,
> optimization and code generation.
Yacc and lex and intimately bound although they can be used
Yacc takes as input the specification for a left-associative
left-reducing language with only one lookahead token (thus it's
lalr(1) designation) and generates a series of tables that a
programme (actually a C function) called yyparse looks at. yyparse()
continuously calls a function names yylex() which you can write
yourself to do your lexical analysis or have lex do for you. The
input format is very similar to BNF (and was inspired by it).
Yacc did indeed get it's name as you have mentioned above. It's
inventor has a quirky sense of humour, as all hackers do. It started
out as the first serious programme of a first year mathematics
student at the University of Waterloo after conversations with S. C.
Johnson (who was on a teaching sabatical at the university at the
time) and Alfred Aho based on Aho and Ullmans (then recently
published book) The Theory of Parsing, Translation and Compiling.
This book was the "parent" of today's "dragon" book. It was then
expanded and improved at Bell Labs and distributed with Unix Release
5 and a paper entitled "The Yacc Compiler Compiler System." by S. C.
Today, Yacc and it's look-alikes drive thousands of other Unix based
programmes including the gnu c compilers, the bash shell and even the
xconfig programme that does the X-based Linux configurations. The
world owes a lot to yacc.
P.S. Vote for Francis, the Linux Doctor(tm).
"A lot of people are rushing in [to Open Source] ... These people say 'I'm an open source advocate' but they're actually not. They just want to get rich quick ... and that could pervert the revolution."
-- Eric Allman
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
More information about the OCLUG