[antlr-interest] Syntactic anti-predicates

Steve Bennett stevagewp at gmail.com
Mon Feb 11 18:38:43 PST 2008


On 2/12/08, Jim Idle <jimi at temporal-wave.com> wrote:
> ws?  // Do you really need this, can't you just use $channel=2 or
> $channel=HIDDEN?

It's a good question. The language is sufficiently poorly defined that
I want to be quite precise about where exactly whitespace is allowed.
And of course, being a text markup language, there are many places
where whitespace must be preserved literally.

Actually come to think of it, I think I can't use $channel=HIDDEN
because the lexer can never be certain whether the whitespace is
significant or not. I think.

>
>         (
>                 PIPE // Take this out of the following rules
>
>                         ( table_caption
>                           | table_data_cells ....
>
>                 | table_header_cells
>  ....

Looks interesting, I'll have a play. Though, isn't there something
less desirable about having a rule like:

table_caption: PLUS ....

When a table caption actually starts PIPE PLUS? It seems less readable
and to make the grammar less useful as a human readable document?

> Or as this looks like wiki, just use global backtracking and
> memorization and let the runtime decide :-)

Yeah, it's an option. But the "how to remove global backtracking" link
that was posted recently convinced me that it's a hell of a lot easier
to add global backtracking than it is to remove it later :)

Steve


More information about the antlr-interest mailing list