1Prof. Aiken CS 143 Lecture 51Introduction to ParsingLecture 5Prof. Aiken CS 143 Lecture 52Outline•Regular languages revisited•Parser overview•Context-free grammars (CFG’s)• Derivations• AmbiguityProf. Aiken CS 143 Lecture 53Languages and Automata•Formal languages are very important in CS–Especially in programming languages•Regular languages–The weakest formal languages widely used–Many applications•We will also study context-free languages, tree languagesProf. Aiken CS 143 Lecture 54Beyond Regular Languages•Many languages are not regular•Strings of balanced parentheses are not regular:( ) |0iiiProf. Aiken CS 143 Lecture 55What Can Regular Languages Express?•Languages requiring counting modulo a fixed integer•Intuition: A finite automaton that runs long enough must repeat states•Finite automaton can’t remember # of times it has visited a particular stateProf. Aiken CS 143 Lecture 56The Functionality of the Parser•Input: sequence of tokens from lexer•Output: parse tree of the program(But some parsers never produce a parse tree . . .)
has intentionally blurred sections.
Sign up to view the full version.