On Apr 12, 2011, at 11:19 AM, Yury Euceda wrote:
> Another thing: For Terence
> 
> I was trying to do the next with ANTLR and it takes me to a mistake

That's because, as you've defined them, integer and real are ambiguous. per the 
usual convention, it chooses to match an integer for 5 not real.

> grammar polinomy;
> INTEGER    :    ('+'|'-')? '0'..'9'+;
> REAL    :    ('+'|'-')? '0'..'9'+ ('.' '0'..'9'*)?;
> VARIABLE:    ('A'..'Z'|'a'..'z')+;
> monomy    :    REAL ('*' VARIABLE ('^' INTEGER)?)?;
> 
> if you try to recognize the string 5 it brings me an error.

The parser will fail when it attempts rule monomy because it is looking for a 
real number not an integer.

> But my algorithm solves it well. I'm sending you a pic showing it

If the algorithm you are using is scannerless, then I would expect a PEG to 
work correctly. With a lexer, that resolved ambiguities normally, I would 
expect a peg or any other person strategy to fail due to mismatched token.

You are making some fairly grand claims on this list. I think we would all 
appreciate some details of your algorithm so we can evaluate your claims.

Ter
PS       also please do not use subject lines like "PEG Digest, Vol 40, Issue 4"
_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to