lex & yacc by Tony Mason - Presentation Transcript
lex & yacc by Tony Mason
Very Good Guide To An Old But Useful Programming Tool
This book shows you how to use two Unix utilities, lex andyacc, in program
development. These tools help programmers build compilers and
interpreters, but they also have a wider range of applications. Youll find
tutorial sections for novice users, reference sections for advanced users,
and a detailed index. Each utility is explained in a chapter that covers
basic usage and simple, stand-alone applications. Youll learn how to
implement a full SQL grammar, with full sample code. Major MS-DOS
and Unix versions of lex and yacc are explored in depth. Also covers
Bison and Flex.
Personal Review: lex & yacc by Tony Mason
Yacc (yet another compiler compiler) and its companion lex (lexical
analyzer) are primarily intended to allow quick and easy development of
small special-purpose languages. The common mistake is assuming that
they are only useful for creating compilers for massively complex eccentric
languages. This is not the case, though you could no doubt use them for
such a purpose.
Lex and Yacc are commonly used together. Yacc uses a formal grammar
to parse an input stream, something which lex cannot do using simple
regular expressions since lex is limited to simple finite state automata.
However, yacc cannot read from a simple input stream - it requires a
series of tokens. Lex is often used to provide yacc with these tokens. As a
result, building an application in lex and yacc is often used as an exercise
in classes on programming languages and the theory of computation to
demonstrate key concepts.
The book starts out building a simple character-driven calculator, and then
moves on to build a menu generation language that produces C code that
uses the standard "curses" library to draw menus on the screen. The final
application is a SQL parser which includes a quick overview of both
relational databases and SQL. Some readers will dislike the fact that Lex
and Yacc are only capable of generating C code. Thus, the logical
conclusion is that you must be able to write C code in order to use these
tools. While it would be nice if the sections about the menu generation
language and the SQL parser had some information about how to do
typechecking and other such things, this book is not about writing a
compiler/interpreter using Lex & Yacc. Rather it is just a beginner's guide.
The sections about shift/reduce and reduce/reduce conflicts are especially
helpful, as are the sections going over the differences and caveats relating
to the major versions of lex and yacc such as AT&T's Lex & YACC, GNU's
Flex & Bison, and Berkeley's Yacc. In summary, if you've never used lex or
yacc before and think they might be useful tools for you, and you already
know the C programming language, this is a handy book to have.
For More 5 Star Customer Reviews and Lowest Price:
lex & yacc by Tony Mason 5 Star Customer Reviews and Lowest Price!
Yacc (yet another compiler compiler) and its compan more
Yacc (yet another compiler compiler) and its companion lex (lexical analyzer) are primarily intended to allow quick and easy development of small special-purpose languages. The common mistake is assuming that they are only useful for creating compilers for massively complex eccentric languages. This is not the case, though you could no doubt use them for such a purpose.
Lex and Yacc are commonly used together. Yacc uses a formal grammar to parse an input stream, something which lex cannot do using simple regular expressions since lex is limited to simple finite state automata. However, yacc cannot read from a simple input stream - it requires a series of tokens. Lex is often used to provide yacc with these tokens. As a result, building an application in lex and yacc is often used as an exercise in classes on programming languages and the theory of computation to demonstrate key concepts.
The book starts out building a simple character-driven calculator, and then moves on to build a menu generation language that produces C code that uses the standard "curses" library to draw menus on the screen. The final application is a SQL parser which includes a quick overview of both relational databases and SQL. Some readers will dislike the fact that Lex and Yacc are only capable of generating C code. Thus, the logical conclusion is that you must be able to write C code in order to use these tools. While it would be nice if the sections about the menu generation language and the SQL parser had some information about how to do typechecking and other such things, this book is not about writing a compiler/interpreter using Lex & Yacc. Rather it is just a beginner's guide.
The sections about shift/reduce and reduce/reduce conflicts are especially helpful, as are the sections going over the differences and caveats relating to the major versions of lex and yacc such as AT&T's Lex & YACC, GNU's Flex & Bison, and Berkeley's Yacc. In summary, if you've never used lex or yacc before and think they might be useful tools for you, and you already know the C programming language, this is a handy book to have. less
0 comments
Post a comment