Question about defining grammars -


i studying grammars , bit confused how design grammars 1 value dependent on another.

for example, want define grammar produces following 3 sentences:

i + = ii : base case

iiii + ii = iiiiii (thats 4 i's + 2 i's equals 6 i's)

iii + = iiii (3 i's + 1 equals 4 i's)

how go this? part confuses me if first 'value' iiii second can 'ii' , not 'i' or 'iii'.

thanks in advance!

grammars trivial if language finite:

s → "i + = ii" s → "iiii + ii = iiiiii" s → "iii + = iiii" 

Comments

Popular posts from this blog

php - How to build a web site which gives a sub-domain dynamically to every registered user? -

c# - Add item to Generic List / Collection using reflection -