Lecture: Grammars and Parsing

Background Material



Context free grammars provide a nice formalism for describing syntax of programming languages. Moreover, there is a mechanism for automatically constructing a parser (a recognizer of valid strings in the grammar) from context free grammars (typically a few additional restrictions are enforced to make it easier to construct the parser). In this lecture we review grammars as a means of describing syntax and show how, either by hand or using automated tools such as bison, to construct a parser from the grammar.


  1. Grammars and Recursive Descent Parsing
  2. Shift/Reduce Parsing, Attribute Grammars and yacc/bison

Lecture Slides


Created: April 3, 2008 (updated May 10, 2012) by jjohnson AT cs DOT drexel DOT DOT edu