Search code examples
parsingyacclex

lex/yacc simple Q


Can lex and yacc be used for making a programming language? and any recommendation for some books.

some references ?

So far i have found some like :

Build code with lex and yacc, Part 1: Introduction


Solution

  • Yes, you can certainly use lex and yacc to build a compiler/translator for a programming or scripting language. There are GNU variants of these tools, called flex and bison. John Levine's lex & yacc was for many years the gold standard for books about these tools. That book may be out of print, but I expect that the successor book, Flex & Bison, is just as good. To dig deeper into building a compiler, start with Aho et al., Compilers: Principles, Techniques, and Tools, 2/e. (Again, my recommendation is based on the first edition of this book.)