def compile_grammar(gt='Grammar.txt', logger=None):
 if (logger is None):
  logger = logging.getLogger()
 logger.info('Generating grammar tables from %s', gt)
 g = pgen.generate_grammar(gt)
 gp = get_compiled_path(gt)
 logger.info('Writing grammar tables to %s', gp)
 try:
  g.dump(gp)
 except IOError as e:
  logger.info(('Writing failed:' + str(e)))

def compile_grammar ( gt = 'Grammar.txt' , logger = None ) : if ( logger is None ) : logger = logging . getLogger ( ) logger . info ( 'Generating grammar tables from %s' , gt ) g = pgen . generate_grammar ( gt ) gp = get_compiled_path ( gt ) logger . info ( 'Writing grammar tables to %s' , gp ) try : g . dump ( gp ) except IOError as e : logger . info ( ( 'Writing failed:' + str ( e ) ) )
compile the grammer .