[antlr-interest] Re: antlr outputting Python code: status?

Gary Duzan gduzan at bbn.com
Tue Jan 20 10:01:53 PST 2004


In Message <E72C084A-4A2A-11D8-BE33-000A95A5641A at sleepycat.com> ,
   Michael Cahill <mjc at sleepycat.com> wrote:

=>> An alternative approach to case statements would be to build a
=>> dictionaries with lambda entries as data--then do lookup and execute.
=>>  That should map fairly easily onto the ANTLR code generation 
=>> framework.
=>
=>Thanks - I agree that's a good approach for a lot of cases, but lambdas 
=>can only be simple expressions and ANTLR generates code with some cases 
=>that raise exceptions or break or nest switch statements, so 
=>unfortunately dictionaries of lambdas can't handle everything that 
=>ANTLR's generated code needs to do.

   True, which is why many suggest avoiding Python lambdas. However,
you can do the same thing with methods (or even bound methods) in a
dictionary, which should give you all the power you need.

					Gary Duzan
					BBN Technologies
					A Verizon Company



 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list