Click here to Skip to main content
15,880,047 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi
how i do statement from grammer in c++ ??

example
grammer :

<s> -> <a> a <b> b | d
<a> -> <a> b | b
<b> -> a <b> | a

build statement :

1- d
2- baab
3- bbaaab
.
.
.



thank you

[edit]Code block added to preserve HTML tags - OriginalGriff[/edit]
[edit]Auto encoder missed the <b> "tags" manually fixed - OriginalGriff[/edit]
Posted
Updated 6-Nov-14 4:56am
v3
Comments
OriginalGriff 6-Nov-14 10:48am    
What have you tried?
Where are you stuck?
What help do you need?
Albert Holguin 6-Nov-14 11:52am    
Your question is not clear.
emm_a 6-Nov-14 12:46pm    
I want the program build random statement from grammer
Richard MacCutchan 6-Nov-14 13:30pm    
You need to write a parser. Google will find you many samples and libraries that you can use to help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900