Ok, I'm having some trouble understanding language grammar. I've been trying to figure out these couple exercises, but I need some help.
The first asks to find all possible strings of seven or fewer letters using this language:
Code:
<string>=$ | <word> | $<string>
<word>=abb | a<word>bb
Where | means "or".
This is what I have so far:
Code:
$
abb
aabbbb
$$
$$$
$$$$
$$$$$
$$$$$$
$$$$$$$
$abb
$aabbbbb
I feel like I'm missing something.
The other was about writing recursive grammar for a language of strings of one or more letters. The first letter must be uppercase, and the other letters must be lowercase.
Here is what I got:
Code:
<string>=<upper> | <string><lower>
<upper>=A | B | ...Z
<lower>=a | b | ...z
Can someone confirm if I'm doing it right?
Thanks a lot for any input!