Skip to main content

Shared Rust/WASM compiler core for Xian contracts

Project description

xian-compiler-core

This crate is the landing zone for the central Rust/WASM compiler described in ../../docs/RUST_COMPILER_CORE.md.

The current slice owns the artifact model, hashing rules, diagnostics, source units, parser adapter, Xian-owned syntax tree, semantic linting, source normalization, structural xian_ir_v1 lowering, and compiler fixture loader. The checked-in compiler fixtures are still generated from the current Python compiler and act as the parity oracle during the migration.

Current Surface

  • SourceUnit: validated source/module/profile input wrapper
  • ContractArtifact: typed xian_contract_artifact_v1 deployment artifact
  • build_contract_artifact(...): construct artifact metadata from canonical source and canonical IR bytes
  • validate_contract_artifact(...): verify artifact format, profile, hashes, JSON IR, and embedded IR identity fields
  • CompilerDiagnostic: stable structured diagnostic payload
  • parse_source(...): RustPython-backed parser adapter for the current Python-like contract syntax, returning an opaque parsed module
  • parse_diagnostics(...): deterministic parser diagnostic adapter with source ranges
  • parse_to_syntax(...): parse source and convert it into a compact Xian-owned syntax tree
  • build_syntax_tree(...): convert an existing parsed module into Xian syntax
  • SyntaxModule, SyntaxStatement, SyntaxExpression: Rust-owned syntax data model used by later lint/normalize/lower stages
  • lint_syntax(...): semantic lint rules over SyntaxModule
  • normalize_syntax(...): deterministic formatter over the Xian syntax tree
  • normalize_source(...): parse, optionally lint, and return canonical source
  • lower_syntax_to_ir(...): lower a validated syntax tree into structural xian_ir_v1
  • lower_source_to_ir(...): normalize, parse, optionally lint, and lower source into structural xian_ir_v1
  • lower_source_to_ir_json(...): return canonical JSON for the lowered IR
  • compile_contract_artifact(...): normalize, lower, and build a hash-checked xian_contract_artifact_v1
  • describe_vm_host_surface(): expose the xian_vm_v1_host_v1 host catalog
  • diagnose_contract(...): first high-level compiler entrypoint; currently validates source/profile, parser diagnostics, unsupported syntax nodes, and semantic lint diagnostics when lint is enabled
  • compiler_version(): machine-readable version and schema metadata
  • CompilerFixture: typed representation of xian.compiler_fixture.v1
  • parse_compiler_fixture_json(...): load a fixture JSON document
  • CompilerFixture::validate_basic(): deterministic structural checks for accepted and rejected fixture records

Fixtures are generated from the current Python compiler with:

uv run python scripts/generate_compiler_fixtures.py \
  packages/xian-compiler-core/tests/sources

Run the Rust fixture checks with:

cargo test --manifest-path packages/xian-compiler-core/Cargo.toml

Check the optional binding layers with:

cargo check --manifest-path packages/xian-compiler-core/Cargo.toml \
  --features python-extension
cargo check --manifest-path packages/xian-compiler-core/Cargo.toml \
  --features wasm

Build the Python package locally with:

uv run python -c "import xian_compiler_core"

Build the WASM package from packages/xian-compiler-core/npm with:

npm run build

The WASM build requires wasm-pack and a Rust toolchain with the wasm32-unknown-unknown standard library installed. The generated npm package is consumed by browser apps such as xian-ide-web and by JS callers that want to compile source locally.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xian_tech_compiler_core-0.1.4b1.tar.gz (71.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xian_tech_compiler_core-0.1.4b1-cp314-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.14+Windows x86-64

xian_tech_compiler_core-0.1.4b1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.14+manylinux: glibc 2.17+ x86-64

xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.14+macOS 11.0+ ARM64

xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_10_12_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.14+macOS 10.12+ x86-64

File details

Details for the file xian_tech_compiler_core-0.1.4b1.tar.gz.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.4b1.tar.gz
Algorithm Hash digest
SHA256 9a80e591253b14b25542a723ba7371ae89ba75c18a582e35df4a2c37ad970fdc
MD5 74c47925df2f277fc421141946cdb665
BLAKE2b-256 0fb1b97fe23ed5cd7435675cc152828ccbafe6b32f98e4a6377a09fe217471b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.4b1.tar.gz:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_compiler_core-0.1.4b1-cp314-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.4b1-cp314-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 01c92a74a54fdfc87aba86e245652803252bab77b0435813ca03e4604123dabb
MD5 8980b201de1f2ab86888afb7112b1bf5
BLAKE2b-256 84691c38c36c1ddb9ec248d307282f468cb99cf3e9c0152e65ec6f14e09eceec

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.4b1-cp314-abi3-win_amd64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_compiler_core-0.1.4b1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.4b1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1569065e47d545c106dcb78277ac9ccb7daffff2a3abeffbf20381aff63055f5
MD5 a28aa588d5220486ef9fae4ef6733185
BLAKE2b-256 a61dc9bab0fd7c802c1bfed4a999309d4c56faf902939cad8115b8c19c99584d

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.4b1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2230124f9bea236c2d84bc0e46cb4e5e09b89e50a306f04b58bd1dbe917bcf2
MD5 dd308d9851c54235204527a82cee8a73
BLAKE2b-256 0b5e0cac876cf706996cd6f9fe75992b3640126a2355646ec25473817c803be0

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fcd9f521bbe82fc3f05f3f383ac69f1d0ee35382af2c0a120b4362f07b3a103a
MD5 55f70a3d5b13f7c067065e39d86f401b
BLAKE2b-256 0a46092154de9387db01258d385cc80cdff672e455b193043b1694264deaf81f

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.4b1-cp314-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page