Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 03.12.09 19:16 
Hallo Community,

kommenden Montag schreibe ich meine Klausur in Formale Sprachen und Automaten.
Als Übungsaufgabe sollen wir zu einer Grammatik G eine formale Sprache L(G) angeben.
G hat folgende Produktionen, Startsymbol ist X:

X->XX
X->aXb
X->bXa
X->e (leeres Wort)

Eine mögliche Ableitung wäre (von mir aufgestellt):
X => aXb => abXab => abXXab => abbXabXaab => abbabaab

Jedoch fällt es mir schwer, dafür eine Sprache L(G) anzugeben.

Kann mir jemand weiterhelfen?

Grüße aus Karlsruhe
Marco

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 03.12.09 19:29 
So auf Anhieb würde ich sagen: Das sind alle Wörter, die gleich viele a's und b's haben. Oder gibt es ein ab-Wort mit der Bedingung, das sich aber mit den Regeln nicht bauen lässt?

Ein regulärer Ausdruck will mir dafür jetzt nicht einfallen, was aber daran liegen könnte, dass die Sprache nicht regulär ist (zumindest ist dir Grammatik nicht vom Typ 3 in der Chomsky-Hierarchie). :D

_________________
We are, we were and will not be.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 03.12.09 19:37 
Hallo Gausi,

ja dann wird es wohl so sein, eine Bildungsvorschrift in der Form wie a^k b^k (nur als Beispiel) fällt mir für die obenstehende Grammatik nicht ein.

Dann wäre L(G) = { w e {a,b}* | #a = #b } korrekt, oder?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 03.12.09 20:21 
Würde ich sagen, ja. :)

_________________
We are, we were and will not be.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 03.12.09 20:24 
naja das wort aabbbbaa wäre teil der sprache aber nicht teil der grammatik oder? oder is das egal? (muss ich noch lernen :mrgreen:)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 03.12.09 20:32 
ausblenden Quelltext
1:
2:
3:
4:
5:
   X -> XX
-> aXbX
-> aXbbXa
-> aabbbXa
-> aabbbbaa


;-)

Nein, das wäre nicht egal, aber dieses Wort lässt sich mit den regeln ableiten

_________________
We are, we were and will not be.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 03.12.09 20:34 
-.- stimmt, danke. Also wirklich noch mehr lernen. :D

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 03.12.09 22:49 
FYI: Der erste Teil der Aufgabe stammt aus dem Dragonbook, 2.2.2 d). Formale Sprache wird in dem Buch (afair) gar nicht behandelt.
Dummerweise gibt es für die Aufgaben keine offizielle Lösung :lol: , Gausis Lösung deckt sich aber wenigstens hiermit: www.cs.odu.edu/~wilson/cs488/key/key1.doc

_________________
>λ=