assn

5
Name :Dweep Sarker ID:CSE-052-06625 Subject : Theory of computing Assignment 2: Is the following grammar ambiguous? SAS | ε AA1 | 0A1 | 01

Transcript of assn

Page 1: assn

Name :Dweep SarkerID:CSE-052-06625

Subject : Theory of computing

Assignment 2: Is the following grammar ambiguous?SAS | ε

AA1 | 0A1 | 01

Page 2: assn

• Left most derivation:

Parse Tree: S

00111001111101 SSASAASS

A

0 A

A 1

1

10

Page 3: assn

• Another , Left most derivation :

Parse Tree: 001110011111010 SSASAASS

A

SA

S

1

1

1

A

0

0

Page 4: assn

The two left most derivation is same, so this Grammar is Ambigous.To move ambigous

01101

AAAAA

SASS

01|10|1

|

FFFPPPA

TTATS

Page 5: assn

Parse Tree:

The unique derivation tree is : 00111

S

TA

1P

0

10

1F