[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: simpleparse - what is wrong with my grammar?

Laszlo Nagy

2/25/2008 2:10:00 PM


>>
> You've created an infinitely recursing grammar. SimpleParse is a
> straightforward recursive descent parser without look-ahead (unless
> explicitly coded) or ambiguity resolution. You are asking it to parse
> "expr" to see if "expr,binop,expr" is matched. It will continue
> recursing down into "expr" until it runs out of ram or otherwise
> encounters a system-level fault.
>
> You need to disambiguate your grammar to have it work with
> SimpleParse. How you do that will depend on what you really meant by
> expr,binop,expr:
>
> a&b&c
>
> could be parsed as either:
>
> ((a&b)&c)
>
> or:
>
> (a&(b&c))
>
> the following creates a parser that produces the first option (which
> is, I *think* what you wanted):
Is there any way I can specify precedence tables? Or do I have to use a
different parser generator then?

Thanks,

Laszlo