This commit is contained in:
2026-06-16 16:09:42 +08:00
commit bffb0cb6b7
644 changed files with 86620 additions and 0 deletions

42
lib/constants/config.py Normal file
View File

@@ -0,0 +1,42 @@
# 常量定义
DEFAULT_INPUT_FILE = 'test.py'
DEFAULT_OUTPUT_FILE = 'test.ll'
SLICE_THRESHOLD = 50
SLICE_LEVEL_DEFAULT = 3
SLICE_LEVELS = {
0: 'no_optimize',
1: 'conservative',
2: 'moderate',
3: 'aggressive',
's': 'size',
}
DEFAULT_COMPILE_COMMAND = 'gcc'
DEFAULT_COMPILE_FLAGS = ''
DEFAULT_METADATA = {
'PROJECT_NAME': 'TransPyC Project',
'AUTHOR': 'TransPyC Team',
'VERSION': '1.0.0',
'DESCRIPTION': 'Auto-generated LLVM IR file',
'COPYRIGHT_YEAR': '2026',
'COPYRIGHT_HOLDER': 'Galactic Vorpal Software Development Studio (e.g. GVSDS Inc.)'
}
ERROR_MESSAGES = {
'MISSING_ARGS': 'Missing required arguments -f and/or -o',
'UNKNOWN_ARG': 'Unknown argument',
'UNSUPPORTED_TYPE': 'Unsupported file type',
'FAILED_PARSE': 'Failed to parse file',
'COMPILE_FAILED': 'Compilation or execution failed'
}
HELP_MESSAGE = '''
Usage: python TransPyC.py -f InputFile -o OutputFile [-wh header_files] [-debug DebugFile]
[-cc compile_command] [-cflags CompileFlags] [-run] [-args RunArgs] [-h HelperFiles]
-h: Specify helper files (C or Python) to help identify structs, functions, variables, and ptrs
'''
mode = "strict"