compiler/stage1_py/l0c.py
Module l0c
Overview Symbols grouped by source file: compiler/stage1_py/l0c.py
Source: compiler/stage1_py/l0c.py Language: Python
Module Members
_CLI_LONG_VALUE_OPTIONS:dict l0c._CLI_LONG_VALUE_OPTIONS_CLI_NAMESPACED_SHORT_VALUE_OPTIONS:dict l0c._CLI_NAMESPACED_SHORT_VALUE_OPTIONS_CLI_CANONICAL_SHORT_VALUE_OPTIONS:dict l0c._CLI_CANONICAL_SHORT_VALUE_OPTIONS_CLI_OTHER_SHORT_VALUE_OPTIONS:dict l0c._CLI_OTHER_SHORT_VALUE_OPTIONS_CLI_VALUE_OPTIONS:tuple l0c._CLI_VALUE_OPTIONScompiler_identity_text:str l0c.compiler_identity_text()- L0 Compiler (l0c) - Stage 1: Analysis and C Code Generation This is the main entry point for the L0 compiler's stage 1, which includes:_scan_cli_presentation_options:Tuple[int, bool] l0c._scan_cli_presentation_options(Sequence[str] argv)- Return fallback verbosity and rich-log settings before -- ._emit_verbose_compiler_identity:None l0c._emit_verbose_compiler_identity(argparse.Namespace args)- Emit the compiler identity through the normal verbose logging path._init_env_defaults:None l0c._init_env_defaults()- Initialize default environment variables based on L0_HOME._load_file_lines:List[str] l0c._load_file_lines(str path, Dict[str, List[str]] cache)- Load lines of a source file, using a cache to avoid redundant reads._emit_diagnostic:None l0c._emit_diagnostic(str message)- Write one normative compiler diagnostic line to standard error.print_diagnostics:None l0c.print_diagnostics(AnalysisResult result)- Print diagnostics from the analysis result.print_diagnostic_list:None l0c.print_diagnostic_list(List[Diagnostic] diagnostics)- Print a list of diagnostics, using a file cache for source snippets.print_diagnostic_with_snippet:None l0c.print_diagnostic_with_snippet(Diagnostic diag, Dict[str, List[str]] file_cache)- Print a single diagnostic, including the source line and a caret._is_valid_module_name:bool l0c._is_valid_module_name(str module_name)- Check if a module name is valid (dot-separated identifiers).build_search_paths:Optional[SourceSearchPaths] l0c.build_search_paths(CompilationContext context, argparse.Namespace args)- Build source search paths from command-line arguments.build_compilation_context:CompilationContext l0c.build_compilation_context(argparse.Namespace args)- Build a CompilationContext from command-line arguments._run_analysis:l0c._run_analysis(argparse.Namespace args)- Run the analysis pipeline._get_module_names:List[str] l0c._get_module_names(argparse.Namespace args, CompilationUnit cu)- Get the list of module names based on the --all-modules flag._find_cc:Optional[str] l0c._find_cc()- Find the best available C compiler._compiler_flag_family:l0c._compiler_flag_family(str compiler)- Determine the compiler family for flag selection using a simple heuristic._is_windows_host:bool l0c._is_windows_host()- Return whether the current Python host is Windows._default_executable_name:str l0c._default_executable_name()- Return the default build output name for the current platform._runtime_include_flags:list[str] l0c._runtime_include_flags(str flag_family, str runtime_include)- Return compiler-family-specific runtime include flags._runtime_library_flags:list[str] l0c._runtime_library_flags(str flag_family, str runtime_lib)- Return compiler-family-specific runtime library search-path flags._output_flags:list[str] l0c._output_flags(str flag_family, Path exe_path)- Return compiler-family-specific output flags._validated_temporary_directory:Path l0c._validated_temporary_directory()- Resolve and validate the host temporary directory._emit_temporary_source_cleanup_failure:None l0c._emit_temporary_source_cleanup_failure(Path c_path)- Report a compiler-temporary source retained after failed cleanup._remove_temporary_c_source:bool l0c._remove_temporary_c_source(Path c_path)- Remove a generated-C temporary and report retained recovery state._write_temporary_c_source:Path l0c._write_temporary_c_source(str c_code)- Atomically create and write one anonymous generated-C source._check_entry_main_for_build:bool l0c._check_entry_main_for_build(AnalysisResult result, str entry_name)- Check that the entry module defines a valid 'main' function for build/run._validate_runtime_library_path:bool l0c._validate_runtime_library_path(str runtime_lib_path)- Validate that the provided runtime library path exists and is a directory._split_c_options:List[str] l0c._split_c_options(Optional[str] raw_options)- Split a raw C options string into individual compiler arguments._get_optimize_flag:Optional[str] l0c._get_optimize_flag(str flag_family, List[str] extra_opts)- Determine the appropriate optimization flag for the compiler family._compile_generated_c:int l0c._compile_generated_c(argparse.Namespace args, CompilationContext context, Path c_path, Path exe_path)- Invoke the selected host compiler for one generated-C source.cmd_build:int l0c.cmd_build(argparse.Namespace args)- Build an executable from an L0 module.cmd_run:int l0c.cmd_run(argparse.Namespace args)- Build and run an L0 module.cmd_codegen:int l0c.cmd_codegen(argparse.Namespace args)- Generate C code for a module.cmd_check:int l0c.cmd_check(argparse.Namespace args)- Run analysis and type checking without code generation.cmd_compile:int l0c.cmd_compile(argparse.Namespace args)- Report that separate compilation is not implemented in Stage 1 yet.cmd_ast:int l0c.cmd_ast(argparse.Namespace args)- Pretty-print the parsed AST._format_token_dump_text:str l0c._format_token_dump_text(tok)- Return token payload text for --tok output._dump_tokens_for_file:int l0c._dump_tokens_for_file(Path path, bool include_eof)- Dump lexer tokens for a single file.cmd_tok:int l0c.cmd_tok(argparse.Namespace args)- Dump lexer tokens.cmd_sym:int l0c.cmd_sym(argparse.Namespace args)- Dump module-level symbol tables.cmd_type:int l0c.cmd_type(argparse.Namespace args)- Dump resolved type information._add_target_args:None l0c._add_target_args(argparse.ArgumentParser parser)- Add target module/file arguments to the parser._add_all_modules_arg:None l0c._add_all_modules_arg(argparse.ArgumentParser parser)- Add the all-modules flag to the parser._add_runtime_args:None l0c._add_runtime_args(argparse.ArgumentParser parser)- Add runtime-related arguments to the parser._add_codegen_arg:None l0c._add_codegen_arg(argparse.ArgumentParser parser)- Add codegen-related arguments to the parser._split_cli_and_program_args:Tuple[List[str], List[str], bool] l0c._split_cli_and_program_args(Sequence[str] argv)- Split compiler CLI arguments from program arguments._normalize_cli_argv:List[str] l0c._normalize_cli_argv(argparse.ArgumentParser parser, Sequence[str] argv)- Normalize exact short-option spellings before passing them to argparse._validate_mode_scoped_flags:None l0c._validate_mode_scoped_flags(argparse.ArgumentParser parser, argparse.Namespace args)- Reject flags that were provided for a mode where they are not valid._validate_reserved_canonical_flags:None l0c._validate_reserved_canonical_flags(argparse.ArgumentParser parser, argparse.Namespace args)- Reject canonical compiler options whose behavior is not implemented.main:None l0c.main(Optional[List[str]] argv=None)- Parse CLI arguments, dispatch the selected mode, and exit.