Parse Tree Check

Check my parse tree :)

Page 1 of 1

0 Replies - 1573 Views - Last Post: 30 January 2009 - 03:04 PM

#1 gMcizzLe   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-January 09

Parse Tree Check

Posted 30 January 2009 - 03:04 PM

Need someone to check this parse for me :)

*NOTE*: All periods used are for spacing purposes ONLY, they carry NO significance at all.

Given (| means OR):

PS -> P..........|
.........P PS
P -> (epsilon) |
.......'(' PS ')' |
.......'<' PS '>' |
.......'[' PS ']'

Parse:

<[][<>]>

Answer (|, \, and / are just tree 'branches'):

.....................PS
......................|
......................P
................... / | \
................'<' PS '>'
..................../....\
..................P......PS
................/ | \......|
.............'[' PS ']'...P
..................|....../ | \
..................P...'[' PS ']'
..................|.........|
............(epsilon)...P
........................../ | \
......................'<' PS '>'
............................|
............................P
............................|
.......................(epsilon)

I hope this is correct. If not, please lead me in the right direction :)

Thank you!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1