Documentation
arx.main
arx.main
Source: packages/arx/src/arx/main.py
title: Arx main module.
Functions
get_bundled_stdlib_root() -> Path
title: Return the bundled stdlib root shipped inside the arx package.
returns:
type: Path
inject_ambient_builtin_imports(module: astx.Module) -> astx.Module
title: Inject compiler-provided builtin bindings into one module AST.
parameters:
module:
type: astx.Module
returns:
type: astx.Module
get_module_name_from_file_path(filepath: str) -> str
title: Return the module name from the source file name.
parameters:
filepath:
type: str
returns:
type: str
Classes
FileImportResolver
title: Resolve import specifiers to Arx source files on disk.
attributes:
input_files:
type: tuple[str, Ellipsis]
cache:
type: dict[str, ParsedModule]
_source_root_cache:
type: dict[Path, Path | None]
_installed_package_index:
type: package_index.InstalledArxPackageIndex | None
Methods
prepare_module(self, module: astx.Module, key: str, origin: str | None) -> ParsedModule
title: Preserve native metadata for actual local or installed origins.
parameters:
module:
type: astx.Module
key:
type: str
origin:
type: str | None
returns:
type: ParsedModule
resolve(self, requesting_module_key: str, import_node: astx.ImportStmt | astx.ImportFromStmt, requested_specifier: str) -> ParsedModule
title: Resolve one import and let expected host failures be wrapped.
parameters:
requesting_module_key:
type: str
import_node:
type: astx.ImportStmt | astx.ImportFromStmt
requested_specifier:
type: str
returns:
type: ParsedModule
ArxMain
title: The main class for calling Arx compiler.
attributes:
input_files:
type: list[str]
output_file:
type: str
is_lib:
type: bool
link_mode:
type: Literal[auto, pie, no-pie]
Methods
run(self, **kwargs: Any) -> None
title: Compile the given source code.
parameters:
kwargs:
type: Any
variadic: keyword
run_tests(self, **kwargs: Any) -> int
title: Collect and execute compiled tests from configured paths.
parameters:
kwargs:
type: Any
variadic: keyword
returns:
type: int
show_ast(self) -> None
title: Print the AST for the given input file.
show_tokens(self) -> None
title: Print the AST for the given input file.
show_llvm_ir(self) -> None
title: Compile into LLVM IR the given input file.
run_binary(self) -> None
title: Run the generated binary.
compile(self, show_llvm_ir: bool=False) -> bool
title: Compile the given input file.
parameters:
show_llvm_ir:
type: bool
returns:
type: bool