Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_build_tables.py41 linesDownload Raw Back to pycparser
1#-----------------------------------------------------------------2# pycparser: _build_tables.py3#4# A dummy for generating the lexing/parsing tables and and5# 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: BSD11#-----------------------------------------------------------------12 13# Insert '.' and '..' as first entries to the search path for modules.14# Restricted environments like embeddable python do not include the15# current working directory on startup.16import importlib17import sys18sys.path[0:0] = ['.', '..']19 20# Generate c_ast.py21from _ast_gen import ASTCodeGenerator22ast_gen = ASTCodeGenerator('_c_ast.cfg')23ast_gen.generate(open('c_ast.py', 'w'))24 25from pycparser import c_parser26 27# Generates the tables28#29c_parser.CParser(30    lex_optimize=True,31    yacc_debug=False,32    yacc_optimize=True)33 34# Load to compile into .pyc35#36importlib.invalidate_caches()37 38import lextab39import yacctab40import c_ast41 
codekingpro/portable-devtools · Team Ai