COMP 302 Lecture Notes - Lecture 23: Parsing, Lexical Analysis, Symbol Table

42 views6 pages

Document Summary

March 9, 2017 ( lecture 23 // week 9, lecture 2 ) Grammars don"t just generate strings; they generate tree structures called parse trees . The structure of the tree tells you something about the grouping. In fact, many of the inadequacies in our standard linear languages is that the linear structure doesn"t reveal grouping. That"s why we use parentheses to manifest grouping. The tree we looked at yesterday was ambiguous. When a grammar produces 2 or more parse trees for a sequence, it is call ambiguous . We need to design unambiguous grammars; but sometimes this is impossible. Here is how we do it for our expressions with generation of numbers thrown in as well: E = generates expressions (last time we only had expressions). The idea is that factors are things that can be multiplied and terms are things that are added. = {+, *, (, ), 0, 1, 2, 3, 4, 9 }

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents