adam wrote:
I was trying to use the yacc.yacc(start='foo') functionality to
specify the starting symbol, and that works ok, but only if i manually
delete parsetab.py.
This sounds like a bug, but I am not sure.
The design assumptions of rule caching are not very clear.
Is there a better way to do what i'm trying to do? Is there a way to
dynamically inject the current/start symbol instead of at grammar
build time?
As I wrote in my previous mail, I don't think there is.
(Like a python language, but where a dict isnt valid standalone, but
is valid in assignment or function calls, etc, but in a different mode
i need to parse just a standalone dict and not anything else).
You could parse 'dict | python_language', and decide afterwards which one you
have.
Another way could be to make classes for your grammars (a 'dict' parser class, and a 'python
language' grammar class), and use inheritance to 'inherit' the dict grammar rules.
Since you are having several parsers in a single program then, you'll have to do more work to
prevent clashes, like your 'parsetab' problem.
Albert
--
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.