"H.-Juergen Godau" <>
Sun, 18 Sep 1994 04:12:36 GMT

          From comp.compilers

Related articles
BNF DEFINITION - help! (1994-09-11)
Re: BNF DEFINITION - help! eanders+@CMU.EDU (Eric A. Anderson) (1994-09-12)
Re: BNF DEFINITION - help! (1994-09-17)
Re: BNF DEFINITION - help! (H.-Juergen Godau) (1994-09-18)
Re: BNF DEFINITION - help! (1994-09-20)
| List of all articles for this month |

Newsgroups: comp.compilers
From: "H.-Juergen Godau" <>
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!
Wirtschaftsinformatik der Produktionsgesellschaften
an der Universitaet Gesamhochschule Essen
Hans-Juergen Godau

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.