Lec12 - CMPSC 461 Programming Language Concepts Lecture 12...

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

View Full Document Right Arrow Icon
CMPSC 461: Programming Language Concepts Lecture 12 Instructor: Prof. Swarat Chaudhuri
Background image of page 1

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

View Full DocumentRight Arrow Icon
Scanning automata Start state Identifier state any letter Comment state % identifier anything else newline comment anything else error any letter or digit Whitespace state space or newline white space anything else
Background image of page 2
LL(1) parsing 1) S F 2) S (S + F) 3) F 1 Start with S on the stack. ( ) 1 + $ S 2 1 F 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Grammars and stacks S A S B S c A a B b a a a a c b b b b a a a c b b b c a a c b b b Prove that: a a a a c b b b b is generated by grammar.
Background image of page 4
Grammars and stacks a a a a c b b b b S A S B String is generated from S if string has prefix generated from A followed by substring generated from S followed by suffix generated from B S B S A Matching tasks a a a a c b b b b
Background image of page 5

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

View Full DocumentRight Arrow Icon
Grammars and stacks a a a a c b b b b A a A matched successfully! Pop! Now must match S first, followed by B To match S … S B S A a B S
Background image of page 6
Grammars and stacks S B S A a B S B S A B a String matched when stack gets empty and there’s no more input
Background image of page 7

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

View Full DocumentRight Arrow Icon
A stack symbol for every nonterminal and terminal At each step, pop left-hand-side of matched rule, push right-hand-side. Keep applying rule until input matches stack top.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/30/2008 for the course CMPSC 461 taught by Professor Chaudhuri during the Fall '08 term at Penn State.

Page1 / 22

Lec12 - CMPSC 461 Programming Language Concepts Lecture 12...

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

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