Lab for Automated Reasoning and Analysis LARA

Compiler-Compilers (Compiler/Parser Generators)

Compiler-compilers are tools that are used to produce a parser from, essentially, a grammar.

The Dinosaurs

The most famous examples of such tools are Lex and Yacc.

  • Lex is a lexical analyzer: it transforms a stream of characters into a stream of tokens. Valid tokens are described eg. with regular expressions.
  • Yacc (Yet Another Compiler Compiler) is a parser generator: from a grammar-like description, it generates a parser with semantic actions

Usually present on Unix distributions nowadays are Flex (Faster, newer lex) and Bison, a backwards-compatible rewrite of Yacc. By force of habit, though, they're still often referred to as Lex and Yacc.

These tools have been around for a while (since the 70s/80s), but are still very commonly used in C/C++ projects. From the Lex manual:

"The asteroid to kill this dinosaur is still in orbit."

Compiler-Compilers for Java

cc10/compiler_compilers.txt · Last modified: 2010/10/18 04:25 by philippe.suter
© EPFL 2018 - Legal notice