[antlr-interest] LL-Regular / WAS: BLOG

Oliver Zeigermann oliver at zeigermann.de
Tue Oct 28 15:26:56 PST 2003


Talking to myself :)

An example for a grammar that would work with LL-regular is one for
XML start tags and empty elements

startTag : LT NAME (NAME = VALUE)* GT ;

emptyElement : LT NAME (NAME = VALUE)* SLASH GT ;

endTag : LT SLASH NAME GT ;

xmlElement
     : startTag
     	( xmlElement
     	| TEXT
        )*
       endTag
      | emptyElement
    ;

Becaues of the attributes, this will not work with any fixed
lookahead, but would require syntactic predicates in ANTLR 2.x

In ANTLR 3.x a regular scan ahead would do!

That's good!

Oliver

--- In antlr-interest at yahoogroups.com, "Oliver Zeigermann"
<oliver at z...> wrote:
> I have just read part of the BLOG and find the idea to scan ahead with
> an FA a very interesting idea. I noticed, I myself as a human, do
> exactly the same when disambiguiting something in a formal language:
> scanning ahead until you find the character you are looking for to
> decide between the options. So, if this method does not work on a
> grammar, the language or the grammar should be fairly unreadable for
> humans as well.



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list