On Jan 29, 5:15 pm, David Beazley <[email protected]> wrote:
> The Grammar object created by yacc is actually a relatively new thing in 
> PLY--part of some refactoring that I did in the Ply-3.x series.   However, 
> using it for other purposes is currently unexplored.  There's no API for 
> getting it or doing anything else with it for that matter.   Thus, if you 
> need to use it, you're going to have to hack something to expose.   However, 
> I would be open to patches or other enhancements to PLY that make it possible 
> to work with that object.
>
> It's probably about time to put out a new PLY release anyways so maybe that 
> would be something to consider.
>


Dave,
Not much hacking is required, really. I cooked up a simple function
(taken from shards of yacc.yacc) pasted here: http://pastebin.com/m45b11057
It gets the same input module as yacc.yacc and just creates the
Grammar object and returns it. The innards of Grammar are well
documented and simple to use.

Not sure how this can be hacked into PLY nicely, though. yacc.yacc
tries to load the table from a precomputed file before it generates
the Grammar itself - the Grammar isn't stored. Perhaps a separate
function is the best approach, granted that the internals of PLY don't
change. They will, of course, so perhaps it can be exposed more
consistently as an API.

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