DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Computer Science (http://www.daniweb.com/forums/forum14.html)
-   -   Problem about grammar rules (http://www.daniweb.com/forums/thread5195.html)

static_ace Apr 10th, 2004 1:09 pm
Problem about grammar rules
 
I have tried looking in my textbook as well as my notes to figure out how to do this problem. I should have asked my teacher when I had the chance, but first I wanted to try working out the problem myself. I have until Monday to figure out how to do this problem, but would appreciate it if you could help me start. Here's the problem:

Show that the grammar is still ambiguous:

<statement> ------> if exp then <substat> else <statement> (1)
| if exp then <statement> (2)
| other-stat (3)

<substat> ---------> if exp then <substat> else <statement> (4)
|other_stat (5)

I at least know that I have to show two different parse trees of a single statement that fits those rules. Other than that, I'm stuck. Please help. :sad:

static_ace Apr 10th, 2004 2:26 pm
Re: Problem about grammar rules
 
Sorry never mind. I finally got the solution.


All times are GMT -4. The time now is 3:46 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC