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.0.tar.gz (68.4 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.0-cp314-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.14+Windows x86-64

xian_tech_compiler_core-0.1.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: xian_tech_compiler_core-0.1.0.tar.gz
  • Upload date:
  • Size: 68.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xian_tech_compiler_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9fe1763c5152c43d876b9a8db8a211421ee4d303677954064c95deccea4b5b81
MD5 f2b9052d2147f43d49b7a80537b989c1
BLAKE2b-256 71297b1dcbf8e08ff83ef32876b2fcfefa29268fbd644ed6e34153413989468c

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.0.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.0-cp314-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.0-cp314-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 843c071901b257d590df14275b1e436bd28ddc0939d36ff947164afbc0b7bc66
MD5 49eabde912361ac757e75e0c95a1d3dc
BLAKE2b-256 43f90aaddd551e597a26747e13bd54e4633c768379805c6678e6d5b1be02dcca

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.0-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.0-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.0-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22462d8b275b0336489ead00d9a7e6cc4a5b33d08e8d78ab52d69e66a74212c6
MD5 97d938c62eb097058fd17073c0e584e7
BLAKE2b-256 a45fe5268113e633d7a90cd2e12599ffaecfc457a50ac5ba3adb8c2e2a383ea2

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.0-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.0-cp314-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.0-cp314-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b0c8517bf9fbdccebd6d189ad1846f8012e89005ec3d0f1637462d0da07fb1a
MD5 99e738e8faa92b63bd4e6ea213d77a78
BLAKE2b-256 66d6886319f3063b16391c8a09144693b645cac26718987a0a7cb0c76facc84b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.0-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.0-cp314-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xian_tech_compiler_core-0.1.0-cp314-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 38b55b24ce56143517ce734b27613118df77d3cb1bd2c5bef9173bf9c177daf4
MD5 26405d60d74318c9a329eb91b41dc987
BLAKE2b-256 191d8b55e1bf137f5f65a683d05bc33e2ae4b98d31ac91599ebe059bb1886940

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_compiler_core-0.1.0-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