E use the correct semancc accons lets demonstrate that

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: arser FuncVons CSE341: Programming Languages CSE341: uncVons need to agree on •  The parser fProgramming Languages where they are in the input ecture 1 Lecture 1 L Course Course Mechanics Mechanics •  Useful invariant: When a parser funcVon is called, M Variable Bindings ML oken (next L nprocessed piece of the the current tVariable Bindings u Dan the expanded non- input) is the token that begins Grossman Dan Grossman Fall 2011 terminal being pFall 2011 arsed –  Corollary: when a parser funcVon is done, it must have completely consumed input correspond to that non- terminal Winter 2013 UW CSE 401 (Michael Ringenburg) 24 Possible Problems CSE341: Programming CSE341: Programming Languages Languages •  Two common problems for recursive- descent parsers (and LL(1) parsers in general). L ecture 1 Lecture 1 Course Course Mechanics Mechanics –  LeP recursion (e.g., EL:= E + T | …) M : Variable Bindings ML Variable Bindings –  Common prefixes on the right side of producVons Dan Grossman Fall 2011 Winter 2013 Dan Grossman Fall 2011 UW CSE 401 (Michael Ringenburg) 25 LeP Recursion Problem CSE341: Programming Languages •  Grammar rule CSE341: Programming Languages •  Code expr ::= expr + term ecture 1 // parse expr ::= … Lecture...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online