Jan25 - CSE262: Programming Languages Instructor: Dr. Liang...

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

View Full Document Right Arrow Icon
CSE262: Programming Languages Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University January 25, 2007
Background image of page 1

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

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 01/25/07 Outline ± Recap: BNF & EBNF ± Attribute grammar (Sections 3.4 of Chapter 3) ± Dynamic semantics (Sections 3.5 of Chapter 3) ± Summary and homework
Background image of page 2
Instructor: Dr. Liang Cheng CSE262: Programming Languages 01/25/07 You should now be able to … ± Evaluate whether a grammar is ambiguous; ± Use BNF to specify operator precedence; ± Use extended BNF.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 01/25/07 You should now be able to … ± Evaluate whether a grammar is ambiguous; ± Use BNF to specify operator precedence and associativity; ± Use extended BNF.
Background image of page 4
Instructor: Dr. Liang Cheng CSE262: Programming Languages 01/25/07 Operator Precedence by BNF ± Guidelines for M precedence levels ± Use terminal operator lexemes ± Different levels in different rules ± Use additional M-1 nonterminals as operands <expr> <expr> <op> <expr> | const <op> / | - An ambiguous grammar <expr> <expr> - <term> | <term> <term> <term> / const | const An unambiguous grammar
Background image of page 5

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

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 01/25/07 Operator Associativity by BNF ± Operator associativity can also be indicated by a BNF description <expr> -> <expr> + <expr> | const (ambiguous) <expr> -> <expr> + const | const (unambiguous) ± Guidelines ± A rule’s LHS appears at the beginning of its RHS, which is a left-recursive rule. Then it indicates left associativity.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

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

Page1 / 22

Jan25 - CSE262: Programming Languages Instructor: Dr. Liang...

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

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