World's most popular travel blog for travel bloggers.

Unsure about parse tree of PCFG

, , No Comments
Problem Detail: 

I'm new to build parse trees and I'm really unsure if I'm doing this right. So I have this example Grammar (S->Sa, S->aSa, S->a) and the word I'm parsing is simply aaaa.

My solution would look like

My Solution

Is this right and is this the only possible parse tree?

Asked By : Kendel Ventonda
Answered By : Rick Decker

Your tree is correct. However, it's not the only possible one. Your tree came from the derivation $$ S\Rightarrow Sa\Rightarrow aSaa\Rightarrow aaaa $$ a different one would be from $$ S\Rightarrow aSa\Rightarrow aSaa\Rightarrow aaaa $$

Best Answer from StackOverflow

Question Source :

3200 people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback