Re: BNF DEFINITION - help!

ellard@bbn.com (Dan Ellard)
Sat, 17 Sep 1994 05:14:19 GMT

          From comp.compilers

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)
| List of all articles for this month |

Newsgroups: comp.compilers
From: ellard@bbn.com (Dan Ellard)
Keywords: parse
Organization: Bolt, Beranek & Newman, Inc.
References: 94-09-024
Date: Sat, 17 Sep 1994 05:14:19 GMT

<banks@iowasp.physics.uiowa.edu> wrote:
> Using character set C={a,b} write a BNF definition for the language
>consisting of all strings with odd length whose first and middle characters are
>the same.


In a yacc-like syntax:


S : a middleA a // an "a" followed by something
| a middleA b // with an "a" in the middle.
// followed by any single char.
| b middleB a // a "b" followed by something
| b middleB b // with a "b" in the middle,
// followed by any single char.
| a // I almost forgot these last two!
| b
;


middleA : a middleA a
| a middleA b
| b middleA a
| b middleA b
| a
;


middleB : a middleB a
| a middleB b
| b middleB a
| b middleB b
| b
;


-Dan
--
Dan Ellard - ellard@bbn.com -- BBN HARK Systems Corporation
--


Post a followup to this message

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