Feb22 - CSE302: Compiler Design Instructor: Dr. Liang Cheng...

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: CSE302: Compiler Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 22, 2007 Instructor: Dr. Liang Cheng CSE302: Compiler Design 02/22/07 Outline Recap Syntax analysis basics (Sections 4.1 & 4.2) Writing a grammar (Section 4.3) Top-down parsing (Section 4.4) Summary and homework Instructor: Dr. Liang Cheng CSE302: Compiler Design 02/22/07 Input And Output Of Parsers A stream of tokens coming from lexer Generate some representation of the parse tree Collecting information about tokens into the symbol table Type checking and static semantic analysis Error handling Instructor: Dr. Liang Cheng CSE302: Compiler Design 02/22/07 Notations for Context-free Grammar stmt if ( expr ) stmt else stmt Terminals Lowercase letters early in the alphabet (a,b,c) Operator symbols Punctuation symbols The digits 0,1,,9 Boldface strings Nonterminals Uppercase letters early in the alphabet (A,B,C,D,E,F) & T E: expressions; T: terms; F: factors Letter S or the head of the 1 st production: start symbol Lowercase, italic names Instructor: Dr. Liang Cheng CSE302: Compiler Design 02/22/07 More Notations for Context-free Grammar Uppercase letters late in the alphabet (X,Y,Z) represent grammar symbols Either nonterminals or terminals Lowercase Greek letters ( , , ,) represent strings of grammar symbols A Lowercase letter late in the alphabet (u,v,w,x,y,z) represent strings of terminals A set of productions A 1 , A 2 , , A k , with a common head A, may be written as A 1 | 2 | | k Instructor: Dr. Liang Cheng CSE302: Compiler Design 02/22/07 Some Terminologies * If S means derives in zero or more steps * program a = b + const + The symbol means derives in one or more steps Instructor: Dr. Liang Cheng CSE302: Compiler Design 02/22/07 BNF vs. Regular Expressions Every construct that can be described...
View Full Document

This note was uploaded on 08/06/2008 for the course CSE 302 taught by Professor Cheng during the Spring '07 term at Lehigh University .

Page1 / 27

Feb22 - CSE302: Compiler Design Instructor: Dr. Liang Cheng...

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