Hello *GV*,

 > Would this work? What do I have to look out for?

Yes, it would work. You may have to look out for the token list, unless 
the base class and derived class have the same lexer tokens...

We've used this approach in our tooling for quite some time now.

Best,
Dennis Hendriks


Le GEC wrote:
> Hello everybody,
> 
> How can I split a grammar definition for PLY over multiple files? What
> would you suggest?
> 
> The first method I see to do this, is to have a nested hierarchy of
> classes for the parser :
> 
> BaseParser = class(PLYParser)     -> in file baseParser.py
>   p_rule_dotted_ident
>   """dotted_ident : ident
>                         | dotted_ident DOT ident"""
>   <blahblah>
> 
> 
> ExprParser = class(BaseParser)       -> in file exprParser.py
>   p_expr_add
>   """add_expr : dotted_ident PLUS dotted_ident"""
> 
> 
> 
> Would this work? What do I have to look out for?
> 
> Do you have other suggestions?
> 
> Thanks in advance,
>   *GV*
> > 


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