Related articles |
---|
BNF DEFINITION - help! banks@iowasp.physics.uiowa.edu (1994-09-11) |
Re: BNF DEFINITION - help! eanders+@CMU.EDU (Eric A. Anderson) (1994-09-12) |
Re: BNF DEFINITION - help! ellard@bbn.com (1994-09-17) |
Re: BNF DEFINITION - help! godau@dec2.wi-inf.uni-essen.de (H.-Juergen Godau) (1994-09-18) |
Re: BNF DEFINITION - help! mab@dst17.wdl.loral.com (1994-09-20) |
Newsgroups: | comp.compilers |
From: | "H.-Juergen Godau" <godau@dec2.wi-inf.uni-essen.de> |
Keywords: | parse |
Organization: | Carnegie Mellon, Pittsburgh, PA |
References: | 94-09-024 94-09-055 |
Date: | Sun, 18 Sep 1994 04:12:36 GMT |
Eric A. Anderson (eanders+@CMU.EDU) wrote:
: [question was to show BNF for odd length strings over {a,b} with the
: first and middle tokens the same]
: It seems to me that you should be able to do Amid' and Bmid' so they
: generate even length strings with the character you want as the
: rightmost of the middle pair. This should eliminate the special case.
: However, it didn't occur to me how to do that.
Just try:
X -> a | b
Y -> a | b
Aeven -> a X | X Aeven Y
Beven -> b X | X Beven Y
Agood -> a | a Aeven
Bgood -> b | b Beven
LANG -> Agood | Bgood
I think this looks nice & short!
juergen
Godau@Dec2.Wi-Inf.Uni-Essen.DE
Wirtschaftsinformatik der Produktionsgesellschaften
an der Universitaet Gesamhochschule Essen
Hans-Juergen Godau
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.