09-Bottom-Up-Parsing - CS 421 Lecture 9: Bottom-up Parsing...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 421 Lecture 9: Bottom-up Parsing s Announcements s OCaml self-help hints s Lecture outline s Bottom-up parsing s ocamlyacc 6/18/2009 1 Announcements s MP4 has been posted s MiniJava lexer s Reminder: midterm exam date Thursday, July 2 6/18/2009 2 OCaml self-help hints s Consult the CS 421 resource guide: s http://www.cs.uiuc.edu/class/su09/cs421/ s Use Tips for using OCaml top level to speed up working with the interactive environment s Consult the OCaml manual when you want a definitive answer about something s May be technical, not user-friendly s Ask on the newsgroup s If you are having a problem, its likely somebody has run into it already, or they will in the future. s Ask Google s It probably knows 6/18/2009 3 OCaml self-help hints s Be careful about s Data types, and type inference s Operator precedence s Common OCaml error messages: s syntax error (underlined) s unbound value use (underlined) s Pattern matching is not exhaustive. Here is a counterexample: s This expression has type < t y p e 1 > but is here used with < t y p e 2 > s Watch out especially for unit s <whatever error> in < f i l e >.ml at line < l i n e > characters < c h a r s > 6/18/2009 4 Top-down vs. bottom-up parsing s Why is top-down called top-down? s As we consume tokens, we build a parse tree. s At any one time, we are filling in the children of a particular non- terminal. s A s s o o n a s w e d e c i d e w h i c h p r o d u c t i o n t o u s e , we can fill in the tree. s In this sense, we are building the tree from the top (root) down (to the leaves). s Nature and Computer Science disagree on this point 6/18/2009 5 Top-down parsing s Example: Input: x + y * z s E id T s T | + E | * E 6/18/2009 6 Bottom-up parsing s Works by creating small parse trees and joining them together into larger ones....
View Full Document

Page1 / 27

09-Bottom-Up-Parsing - CS 421 Lecture 9: Bottom-up Parsing...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online