Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

posted 2014-11-15 20:48:32 +0100

Gramatika -> regex

Ahojte, chcel by som poprosit este o radu, kde mam chybu. Snazim sa previest gramatiku na regularny vyraz. Tu je zadanie

  S-> aE | aS | bS | aA | eps
  A -> aA
  B -> a
  C -> a | b | aA | bE
  D -> aD | bD | bB | bA
  E -> bD

A takto postupujem ja

  S = aE + aS + bS + **aA** + eps
  **A = aA**
  B = a
  C = a + b + **aA** + bE
  D = aD + bD + bB + **bA**
  E = bD

tucne resp. medzi hviezdickami su nepotrebne stavy

Tu dosadzujem

D = (a + b)D  + ba = (a + b)* ba
E = b(a + b)*ba
C = a + b + b[b(a + b)*ba ]
S = (a+b)* a [a + b + b[b(a + b)*ba ]]

Podla vysledku mi to vsak nesedi, ten by mal byt

S=(a+b)*(ab(a+b)*ba+eps)

Viete mi niekto poradit? Dakujem.

Gramatika -> regex

Ahojte, chcel by som poprosit este o radu, kde mam chybu. Snazim sa previest gramatiku na regularny vyraz. Tu je zadanie

  S-> aE | aS | bS | aA | eps
  A -> aA
  B -> a
  C -> a | b | aA | bE
  D -> aD | bD | bB | bA
  E -> bD

A takto postupujem ja

  S = aE + aS + bS + **aA** + eps
  **A = aA**
  B = a
  C = a + b + **aA** + bE
  D = aD + bD + bB + **bA**
  E = bD

tucne resp. medzi hviezdickami su nepotrebne stavy

Tu dosadzujem

D = (a + b)D  + ba = (a + b)* ba
E = b(a + b)*ba
C = a + b + b[b(a + b)*ba ]
S = (a+b)* a [a + b + b[b(a + b)*ba ]]

Podla vysledku mi to vsak nesedi, ten by mal byt

S=(a+b)*(ab(a+b)*ba+eps)

Viete mi niekto poradit? Dakujem.