[DGD] Grammar question

Jay Shaffstall jshaffst at netwalk.com
Wed May 14 18:04:29 CEST 2003


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



More information about the DGD mailing list