You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
859 B

  1. #-----------------------------------------------------------------
  2. # pycparser: _build_tables.py
  3. #
  4. # A dummy for generating the lexing/parsing tables and and
  5. # compiling them into .pyc for faster execution in optimized mode.
  6. # Also generates AST code from the configuration file.
  7. # Should be called from the pycparser directory.
  8. #
  9. # Eli Bendersky [https://eli.thegreenplace.net/]
  10. # License: BSD
  11. #-----------------------------------------------------------------
  12. # Generate c_ast.py
  13. from _ast_gen import ASTCodeGenerator
  14. ast_gen = ASTCodeGenerator('_c_ast.cfg')
  15. ast_gen.generate(open('c_ast.py', 'w'))
  16. import sys
  17. sys.path[0:0] = ['.', '..']
  18. from pycparser import c_parser
  19. # Generates the tables
  20. #
  21. c_parser.CParser(
  22. lex_optimize=True,
  23. yacc_debug=False,
  24. yacc_optimize=True)
  25. # Load to compile into .pyc
  26. #
  27. import lextab
  28. import yacctab
  29. import c_ast