[DGD] Grammar question

Erwin Harte harte at is-here.com
Wed May 14 18:06:42 CEST 2003


On Wed, May 14, 2003 at 12:04:29PM -0400, Jay Shaffstall wrote:
[...]
> 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?

To parse_string() once you've used a constant string, it won't match
the more generic tokens that you've defined.

Here's a workaround:

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

	Word: word
	Word: 'write'

You'll want to extend Word with any other keywords that occur in your
grammar.

Hope that helps,

Erwin.
-- 
Erwin Harte        |  I'm using a whitelist to block spam.  If you get
harte at is-here.com  |  a bounce when emailing me directly that either
                   |  means you haven't emailed me in the past 7 years
                   |  or your address changed.  If so, please register.
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list