Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
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.

_build_tables.py 1.0KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637
  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. # Insert '.' and '..' as first entries to the search path for modules.
  13. # Restricted environments like embeddable python do not include the
  14. # current working directory on startup.
  15. import sys
  16. sys.path[0:0] = ['.', '..']
  17. # Generate c_ast.py
  18. from _ast_gen import ASTCodeGenerator
  19. ast_gen = ASTCodeGenerator('_c_ast.cfg')
  20. ast_gen.generate(open('c_ast.py', 'w'))
  21. from pycparser import c_parser
  22. # Generates the tables
  23. #
  24. c_parser.CParser(
  25. lex_optimize=True,
  26. yacc_debug=False,
  27. yacc_optimize=True)
  28. # Load to compile into .pyc
  29. #
  30. import lextab
  31. import yacctab
  32. import c_ast