I'm trying to figure out how to create a CFG for univocalic words...
Univocalic words are words that have only one the same vowel letter throughout the word
Example: September, Anna
Would appreciate any of your help..
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
Try the following grammar (which can be transformed into a regular grammar):
$S \rightarrow A \mid E \mid I \mid O\mid U$
$A \rightarrow aA \mid bA \mid cA \mid \dots \mid zA \mid \epsilon$ (all consonants and only 'a')
$E \rightarrow eE \mid bE \mid cE \mid \dots \mid zE \mid \epsilon$ (all consonants and only 'e')
$I \rightarrow iI \mid bI \mid cI \mid \dots \mid zI \mid \epsilon$ (all consonants and only 'i')
$O \rightarrow oO \mid bO \mid cO \mid \dots \mid zO \mid \epsilon$ (all consonants and only 'o')
$U \rightarrow uU \mid bU \mid cU \mid \dots \mid zU \mid \epsilon$ (all consonants and only 'u')
Example 1: $S \Rightarrow A \Rightarrow aA \Rightarrow anA \Rightarrow annA \Rightarrow annaA \Rightarrow anna$
Example 2: $S \Rightarrow E \Rightarrow sE \Rightarrow seE \Rightarrow sepE \Rightarrow septE \Rightarrow septeE \Rightarrow septemE \Rightarrow$ $septembE \Rightarrow septembeE \Rightarrow septemberE \Rightarrow september$
Warning: do not expect that this grammar generates only English dictionary words. For example it does generate a nonsense such as 'aagfdadgsa'.