On Apr 18, 12:09 am, Pavel Panchekha <[email protected]> wrote:
> In general, I've been very happy with PLY, especially considering how
> terrible most parser generators are to work with. But one thing that
> I've really missed with PLY is EBNF. I know, I know, its not strictly
> necessary. The thing is, in a language I'm writing I've got the
> following EBNF rule:
>
> > index : [expr] [':' [expr]] [':' [expr]]
>
> Which properly represents a python index (array subscript). The thing
> is, this one EBNF rule boils down to 10 BNF rules. It gets worse -
> functions have several optional parts. About four. That boils down to
> 16 rules. And I'm thinking of making another part of function
> definitions optional. With EBNF, that's easy, just add brackets. But
> with BNF, that means double the number of rules.
>
> Any possibility of EBNF somewhere down the pipe?

The PLY documentation includes an example of creating an "optional"
rule for some token/subrule. This can be easily employed to write the
above EBNF rule in a single PLY rule (assuming expr_opt already
exists).

Eli


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" 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/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to