10/11/2017 1
Supplemental Materials: Grammars, Parsing, and Expressions
CS2: Data Structures and Algorithms Colorado State University
Original slides by Chris Wilcox, Updated by Russ Wakefield and Wim Bohm
Topics
Grammars Production Rules Prefix, Postfix, and Infix Tokenizing and Parsing Expression Trees and Conversion Expression Evaluation
CS165: Data Structures and Algorithms – Spring Semester 2017
2
Grammars
Programming languages are defined using grammars with specific properties. Grammars define programming languages using a set of symbols and production rules. Grammars simplify the interpretation of programs by compilers and other tools. Grammars avoid the ambiguities associated with natural languages.
CS165: Data Structures and Algorithms – Spring Semester 2017
3