1
$\begingroup$

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..

$\endgroup$
  • $\begingroup$ What did you try? Where did you get stuck? We're happy to help with conceptual questions but just solving homework-style exercises for you is unlikely to really help you understand. Have you noticed that the langauge here is regular? $\endgroup$ – David Richerby Sep 29 '17 at 9:33
  • $\begingroup$ Here is my CFG that i created S→ CaA | CeE | CiI | CoO | CuU C→ consonant|ϵ A→ CA|aA|a|C|ϵ E→ CE|eE|e|C|ϵ I→ CI|iI|i|C|ϵ O→ CO|oO|o|C|ϵ U→ CU|oU|u|C|ϵ Example 1: S⇒CeE⇒seE⇒seCE⇒sepE⇒sepCE⇒septE⇒septeE⇒septeCE⇒septemE⇒septembeE⇒septembeC⇒september Is it correct or not? $\endgroup$ – Mona Lisa Sep 30 '17 at 1:54
0
$\begingroup$

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'.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.