[antlr-interest] is it feasible to use antl for python code-generator?

Japan Shah jsh at axelor.com
Wed Aug 11 23:54:57 PDT 2010


Hello,

       we've requirement to generate python code based on XLS/CSV template
like,

*example below,*
*object,contract
inherit, orm_base
name, contract
table,contract_contract*
fields1, is_valid type boolean
field2, name type char


and need to write few business login in raw text like

if (current_contract.is_valid)
       return True
else
       return False


and the Output from such CSV File would be a python class file like below,

class contract(orm_base):
      is_valid = fields.boolean()
      name = fields.char()

      def check(self):
            if self.data['is_valid']:
                 return True
            return False


My Question is is it feasible to use ANTLR either to generate the Python
Classes or to evaluate the users' business logic from raw text as provided
above ?

--
Thanks,
#Japan Shah


More information about the antlr-interest mailing list