Autor Beitrag
klezmor
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Di 16.09.08 00:29 
Kann mir jemand sagen wie ich zu folgender Sprache eine Grammatik finde:
L= aabcc, aaaabccbbb, aaaaaabccbbbcccc, aaaaaaaabccbbbccccbbbbb ... das system sollte man schnell durchschauen. immer eine gerade anzahl an as sowie eine gerade anzahl an cs, sowie eine ungerade anzahl an bs, das kleinste wort ist aabcc.

Danke im Voraus.

Gruß Klezmor.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 16.09.08 03:42 
Also erstmal definieren wir die beiden Teile für die gerade Anzahl der Terminalsymbole a und c:

A = aaA
A = €
C = ccC
C = €

Gut, nun der kompliziertere Teil: wie definiert man das mit den B's???

Also zuerst mal: A's IMMER zuerst!
S = AB

Wenn mindestens 2 a's und ein b notwendig ist, muss obige Regel wie folgt geändert werden:
S = AaabB

k, weiter:
Ungerade Anzahl an b's zulassen
B = bB
Und jetzt noch die C's einbinden:
B = BCB
Jetzt fehlt nur noch die Möglichkeit, dass B auch leer sein kann:
B = €

Wäre's nach meiner Ansicht für diese Grammatik schon ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Di 16.09.08 10:13 
Aber wäre laut deiner Grammatik nicht auch das Wort aab in der Sprache enthalten, dies sollte eigentlich ausgeschlossen werden, das kleinste Wort ist aabcc.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 16.09.08 13:12 
Dann nimm als Startregel
S = AaabBcc

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mi 24.09.08 17:29 
@BenBE: wenn ich das jetzt richtig sehe kann bei deiner Grammatik die Anzahl an bs sowohl gerade als auch ungerade sein...

Ich würde daher folgende Änderungen vorschlagen:
A = aaA
A = €
C = ccC
C = €

B = bbB
B = bBCbB
B = €

S = AaabBccCB

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Do 25.09.08 10:10 
Die Sprache, wie ich sie hinschrieb, ist gar nicht über eine Grammatik definierbar. War ein Fehler von mir, hatte die Sprache falsch interpretiert.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth