Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Parsing Table - Automata and Complexity Theory - Lecture Slides, Slides of Theory of Automata

Some concept of Automata and Complexity Theory are Administrivia, Closure Properties, Context-Free Grammars, Decision Properties, Deterministic Finite Automata, Intractable Problems, More Undecidable Problems. Main points of this lecture are: Parsing Table, Computer Science, Engineering, Given Grammar, Construct the Deterministic, Abbcde, Abbce, Shifting, Parsing Table, Parsing Abbcde

Typology: Slides

2012/2013

Uploaded on 04/29/2013

shamir_69
shamir_69 🇮🇳

5

(4)

66 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
LR(0) Parsing Table
Department of Computer Science & Engineering
Docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Parsing Table - Automata and Complexity Theory - Lecture Slides and more Slides Theory of Automata in PDF only on Docsity!

LR(0) Parsing Table

Department of Computer Science & Engineering

LR(0) Example

• Given grammar G:

  • S →a A c B e
  • A →b
  • A →A b
  • B →d

• Construct the deterministic PDA that parse.

• Show the parsing process for string abbcde

and abbce

Parsing Table

ACTION GOTO a c e b d # S A B 0 S 2 1 1 acc 2 S 4 3 3 S 5 S 6 4 r 2 r 2 r 2 r 2 r 2 r 2 5 S 8 7 6 r 3 r 3 r 3 r 3 r 3 r 3 7 S 9 8 r 4 r 4 r 4 r 4 r 4 r 4 9 r 1 r 1 r 1 r 1 r 1 r 1

Parsing abbcde

  • 1 0 # abbcde# s Step states. Syms. The rest of input action goto
  • 2 02 #a bbcde# s
  • 3 024 #ab bcde# r2
  • 4 023 #aA bcde# s
  • 5 0236 #aAb cde# r3
  • 6 023 #aA cde# s
  • 7 0235 #aAc de# s
  • 8 02358 #aAcd e# r4
  • 9 02357 #aAcB e# s
  • 10 023579 #aAcBe # r1

Practice

• Grammar G:

  • (0) S`→E (1) E→aA (2) E→bB
  • (3) A→cA (4) A→d (5) B→cB
  • (7) B→d

• PDA states for LR(0):

  • I 0 : S→** .E I 1 **: S→E . I 2 : E→a .A
  • E→aA A→.cA
  • E→bB A→ .d

PDA states cont.

I 3 : E→b .B I4 : A→c .A I 5 : B→c .B

B→ .cB A→ .cA B→ .cB

B→ .d A → .d B→ .d

I 6 : E →aA . I 7 : E →bB . I 8 : A →cA .

I 9 : B →cB . I10 : A→d . I 11 : B→d .