I convert grammar http://www.antlr.org/grammar/HTML to ANTLR version 3 
from 2.
I meet error:
error(211): HTML.g:209:3: [fatal] rule paragraph has non-LL(*) decision 
due to recursive rule invocations reachable from alts 1,2.  Resolve by 
left-factoring or using syntactic predicates or using backtrack=true option.

Rule is:
paragraph
  : OPARA
   (
    /*  Rule body_content may also be just plain text because HTML is
        so loose.  When body puts body_content in a loop, ANTLR
        doesn't know whether you want it to match all the text as part
        of this paragraph (in the case where the </p> is missing) or
        if the body rule should scarf it.  This is analogous to the
        dangling-else clause.  I shut off the warning.
        */
        /*options {
        generateAmbigWarnings=false;
        }*/
        text
   )*
   (CPARA)?     
   ;

options {backtrack=true;} nothing do, and backtracking is not good 
because slown down parsing. Can be more text:
OPARA text text text .. (CPARA)
OPARA
        :       '<p' (WS ATTR)? '>'
        ;

CPARA
        :       '</p>'          //it's optional
        ;

It is possible to left-factoring ? How use syntactic predicates ?

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to