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

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

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_shell(self) -> None
title: Open arx in shell mode.
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