That is true, but while that does somewhat fix the problem, it still
requires extra rules. It'd be nice if PLY would allow the full suite of EBNF
grammars (including repetitions and optional parts). Several parts of my
grammar require a list of items. Currently, this requires an extra recursive
rule (and handler code to deal with it). It'd be nice if PLY could handle
that for you.

- Pavel Panchekha


On Mon, Apr 20, 2009 at 11:22 AM, eliben <[email protected]> wrote:

>
> 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