arx.builtins

arx.builtins

Source: packages/arx/src/arx/builtins.py

title: Compiler builtin helpers and bundled builtin-module loader.

Functions

is_builtin(name: str) -> bool

title: Check whether a function name is a parser-level built-in.
parameters:
  name:
    type: str
returns:
  type: bool

build_cast(value: astx.DataType, target_type: astx.DataType) -> irx_astx.Cast

title: Build an IRx Cast node.
parameters:
  value:
    type: astx.DataType
  target_type:
    type: astx.DataType
returns:
  type: irx_astx.Cast

build_isinstance(value: astx.Expr, target_type: astx.DataType) -> irx_astx.IsInstanceExpr

title: Build an IRx IsInstanceExpr node.
parameters:
  value:
    type: astx.Expr
  target_type:
    type: astx.DataType
returns:
  type: irx_astx.IsInstanceExpr

build_print(message: astx.Expr) -> irx_astx.PrintExpr

title: Build an IRx PrintExpr node.
parameters:
  message:
    type: astx.Expr
returns:
  type: irx_astx.PrintExpr

build_type_of(value: astx.Expr) -> irx_astx.TypeOfExpr

title: Build an IRx TypeOfExpr node.
parameters:
  value:
    type: astx.Expr
returns:
  type: irx_astx.TypeOfExpr

is_builtin_module_specifier(specifier: str) -> bool

title: Return whether one specifier targets the bundled builtins.
parameters:
  specifier:
    type: str
returns:
  type: bool

list_builtin_modules() -> tuple[str, ...]

title: List bundled builtin module names.
returns:
  type: tuple[str, Ellipsis]

resolve_builtin_resource(module_name: str) -> Traversable

title: Resolve one builtin logical module name to a packaged resource.
parameters:
  module_name:
    type: str
returns:
  type: Traversable

get_builtin_source(module_name: str) -> str

title: Return the bundled source text for one builtin module.
parameters:
  module_name:
    type: str
returns:
  type: str

load_builtin_module(specifier: str) -> BuiltinModuleAsset

title: Load one builtin module from packaged resources.
parameters:
  specifier:
    type: str
returns:
  type: BuiltinModuleAsset

get_ambient_builtin_imports(module_key: str) -> tuple[irx_astx.ImportFromStmt, ...]

title: Build the implicit builtin imports for one module.
parameters:
  module_key:
    type: str
returns:
  type: tuple[irx_astx.ImportFromStmt, Ellipsis]

Classes

BuiltinModuleAsset

title: One bundled builtin module asset.
attributes:
  logical_name:
    type: str
  specifier:
    type: str
  origin:
    type: str
  source:
    type: str
  is_package:
    type: bool

AmbientBuiltinBinding

title: One compiler-injected builtin binding.
attributes:
  name:
    type: str
  module:
    type: str