On 2/17/08, David Gerard <dgerard(a)gmail.com> wrote:
Does this make the ANTLR problem any simpler?
No. But it's interesting.
This line:
wikitext-L2 = heading / wikitext-L3 / *wikitext-L2
must be incorrect, right? It's just infinitely recursive on the third
alternative?
One thing I really notice comparing ABNF and ANTLR is this kind of thing:
comment = "<!--" literal "-->"
ABNF apparently doesn't distinguish lexing and parsing. In ANTLR, if
you specified a rule like that, it would generate lexer tokens for the
"<!--" and "-->" and possibly break all kinds of near-misses.
For
example "<!-blah" seems to become unparseable. So you end up with
workarounds like this:
HTML_COMMENT:
(('<!--') => '<!--' .* ('-->' | EOF) {
$channel=HIDDEN; })
| '<' { $type=LT; };
(not that that quite works, but...)
Steve