[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reusing Grammars (howto use grammars in grammars)



I might do something that combines both suggestions. I'll have atomic grammar files (ensuring unique Token, Production, etc, names). Then reuse them in grammars that need those definitions.

Reusing grammars would be a nice feature to have in Sablecc4 ( hint hint ;). Thanks for the feedback.

Tim


----- Original Message ----
From: Timothy Washington <timothyjwashington@xxxxxxxx>
To: sablecc-discussion@xxxxxxxxxxxxxxxxx
Sent: Wednesday, September 17, 2008 5:22:50 PM
Subject: Reusing Grammars (howto use grammars in grammars)


Hi there. I have what might be a basic question regarding Sablecc 3.

How can I abstract out grammars and reuse them in other grammars? For example, I want to implement XML, XPath, XQuery and "MyCustomLang". XML and XPath are subsets of XQuery and "MyCustomLang" however. So I don't want to define the first 2 languages thrice (by themselves, then each in XQuery and "MyCustomLang").

Is there a way to import .sablecc definitions or just the ASTs into another .sablecc file (AST)? Thanks in advance for any help.

Tim



All new Yahoo! Mail - Get a sneak peak at messages with a handy reading pane.


Now with a new friend-happy design! Try the new Yahoo! Canada Messenger