[DGD] Grammar question

Keith Dunwoody keithdunwoody at yahoo.com
Wed May 14 18:19:28 CEST 2003


The problem is that if you put a word in quotes, it
will _only_ match a quoted word in the grammar -- not
any other definitions.  I believe a correct grammar
is:

 	whitespace = /[\b\n\r\t ]/
 	word = /[^\b\n\r\t ]+/
 	command: 'write' multiword
 	multiword: word multiword
        multiword: 'write'
 	multiword: word
        multiword: 'write'

--- Jay Shaffstall <jshaffst at netwalk.com> wrote:
> I thought I'd been doing pretty well with writing
> grammars, but have just 
> encountered a problem that I could use some
> assistance with.  I have the 
> following simple grammar that demonstrates the
> problem:
> 
> 	whitespace = /[\b\n\r\t ]/
> 	word = /[^\b\n\r\t ]+/
> 	command: 'write' multiword
> 	multiword: word multiword
> 	multiword: word
> 
> The goal is to support a command of the form "write
> *" where * is any 
> sequence of words.  This works fine, except when one
> of the words is 
> "write".  So "write I will write" will fail to
> parse.
> 
> I'm obviously not understanding how the grammars
> parse, since to me it 
> looks as if the grammar should match "write I will
> write".  Can anyone 
> explain why this does not parse, and suggest a way
> around the problem?
> 
> Thanks,
> Jay
> 
>
_________________________________________________________________
> List config page: 
http://list.imaginary.com/mailman/listinfo/dgd


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list