diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2fd219d..a64ff2e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Found something wrong? Let us know. title: "[BUG] " labels: bug -assignees: '' +assignees: "" --- # Describe the Bug diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md index cf73ab1..d64c211 100644 --- a/.github/ISSUE_TEMPLATE/feature.md +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -3,7 +3,7 @@ name: Feature about: A new feature to be added. title: "[FEAT] " labels: enhancement -assignees: '' +assignees: "" --- # Description diff --git a/.github/ISSUE_TEMPLATE/performance.md b/.github/ISSUE_TEMPLATE/performance.md index 5a5657e..24353ba 100644 --- a/.github/ISSUE_TEMPLATE/performance.md +++ b/.github/ISSUE_TEMPLATE/performance.md @@ -3,7 +3,7 @@ name: Performance about: An opportunity for performance improvement or other performance-related work. title: "[PERF] " labels: enhancement -assignees: '' +assignees: "" --- # Description diff --git a/.github/ISSUE_TEMPLATE/task.md b/.github/ISSUE_TEMPLATE/task.md index 37b3994..331c504 100644 --- a/.github/ISSUE_TEMPLATE/task.md +++ b/.github/ISSUE_TEMPLATE/task.md @@ -3,7 +3,7 @@ name: Task about: A development task to be done. title: "[TASK] " labels: enhancement -assignees: '' +assignees: "" --- # Description diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f1a0a4..f9d2720 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,28 +2,27 @@ name: CI on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "*" ] + branches: ["*"] # Environment variables that will be set on all runners env: DEV_SHELL_LINUX: "nix --store ~/nix_store develop '.#ci'" DEV_SHELL_MACOS: "nix develop '.#ci'" - CARGO_TERM_COLOR: always # Always colour Cargo's output. - CARGO_INCREMENTAL: 0 # Always run without incremental builds on CI. + CARGO_TERM_COLOR: always # Always colour Cargo's output. + CARGO_INCREMENTAL: 0 # Always run without incremental builds on CI. CARGO_PROFILE_DEV_DEBUG: 0 # Don't embed debug info even though the build is a dev build. # Configuration for individual jobs jobs: - # This job is responsible for running the unit and integration tests test: name: "Test" strategy: fail-fast: false matrix: - os: [ "ubuntu-latest", "macos-latest" ] + os: ["ubuntu-latest", "macos-latest"] runs-on: ${{ matrix.os }} steps: - name: Checkout Code @@ -72,7 +71,7 @@ jobs: # This job runs the linter. lint: - name: "Lint" + name: "Lint Code" runs-on: "ubuntu-latest" steps: - name: Checkout Code @@ -102,9 +101,9 @@ jobs: - name: Lint Code shell: bash run: | - ${{ env.DEV_SHELL_LINUX }} --command cargo clippy --all-targets + ${{ env.DEV_SHELL_LINUX }} --command cargo clippy --all-targets --all-features - # This job checks the code formatting. + # This job checks the formatting of the code and other artifacts. formatting: name: "Check Formatting" runs-on: "ubuntu-latest" @@ -137,3 +136,11 @@ jobs: shell: bash run: | ${{ env.DEV_SHELL_LINUX }} --command cargo fmt --all -- --check + - name: Install Node Deps + shell: bash + run: | + ${{ env.DEV_SHELL_LINUX }} --command npm install + - name: Lint Documentation + shell: bash + run: | + ${{ env.DEV_SHELL_LINUX}} --command npx prettier --check . diff --git a/.gitignore b/.gitignore index 8460752..c4aac5b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,9 @@ # Tooling .idea/ +node_modules/ result + +# Linting and Formatting +package-lock.json +.husky/_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..f1f12b5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +cargo clippy --all-targets --all-features -- -D warnings && cargo +nightly fmt && npx lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..4f9ee04 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +# Generated Lockfiles +Cargo.lock +package-lock.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..b74084c --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "printWidth": 100, + "proseWrap": "always", + "tabWidth": 2, + "plugins": ["prettier-plugin-toml"] +} diff --git a/Cargo.lock b/Cargo.lock index a4e6426..04d5643 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,33 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "anstream" version = "0.6.15" @@ -38,7 +65,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -48,7 +75,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -67,6 +94,390 @@ dependencies = [ "yansi", ] +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "cairo-lang-compiler" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5852668d1c6966b34d6e4fe249732769ab9cb2012c201e3889d8119f206760a0" +dependencies = [ + "anyhow", + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-lowering", + "cairo-lang-parser", + "cairo-lang-project", + "cairo-lang-semantic", + "cairo-lang-sierra", + "cairo-lang-sierra-generator", + "cairo-lang-syntax", + "cairo-lang-utils", + "indoc", + "rayon", + "rust-analyzer-salsa", + "semver", + "smol_str", + "thiserror", +] + +[[package]] +name = "cairo-lang-debug" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0644fab571f598547993936918c85f0e89b0bbc15140ca3ea723bff376be07d" +dependencies = [ + "cairo-lang-utils", +] + +[[package]] +name = "cairo-lang-defs" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f5f437d75ac25644880458effde562edcac45a888d27f2e497d30c6450fa97d" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-parser", + "cairo-lang-syntax", + "cairo-lang-utils", + "itertools 0.12.1", + "rust-analyzer-salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-diagnostics" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ec5b44d3eaf50e28e068d163e56b9effcea6afe3625c32dd96418d2d4ebc34c" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-filesystem", + "cairo-lang-utils", + "itertools 0.12.1", +] + +[[package]] +name = "cairo-lang-eq-solver" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0cd844e568f51e39729e8ac18bd27ada2e2b6dc9138f8c81adad48456480681" +dependencies = [ + "cairo-lang-utils", + "good_lp", +] + +[[package]] +name = "cairo-lang-filesystem" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "323a2385e000589f7591f8a46599b4a462db6e36e5935bad3bceddcc1a1608e1" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-utils", + "path-clean", + "rust-analyzer-salsa", + "semver", + "serde", + "smol_str", +] + +[[package]] +name = "cairo-lang-formatter" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cf9cf637e12d41260dc59f3d988c76a6347424913ac8b6b8449ff3e79b59750" +dependencies = [ + "anyhow", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-parser", + "cairo-lang-syntax", + "cairo-lang-utils", + "diffy", + "ignore", + "itertools 0.12.1", + "rust-analyzer-salsa", + "serde", + "smol_str", + "thiserror", +] + +[[package]] +name = "cairo-lang-lowering" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d71bc5b1f19a00eb662c2cac33259b16b9cdbf9c005047aca0d538c13936407" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-parser", + "cairo-lang-proc-macros", + "cairo-lang-semantic", + "cairo-lang-syntax", + "cairo-lang-utils", + "id-arena", + "itertools 0.12.1", + "log", + "num-bigint", + "num-traits 0.2.19", + "rust-analyzer-salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-parser" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d939d258e26ace0f3cb1e50338ae18981a7505e3c20eabd24a62d70ee862d6c" +dependencies = [ + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-syntax", + "cairo-lang-syntax-codegen", + "cairo-lang-utils", + "colored", + "itertools 0.12.1", + "num-bigint", + "num-traits 0.2.19", + "rust-analyzer-salsa", + "smol_str", + "unescaper", +] + +[[package]] +name = "cairo-lang-plugins" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67a553a6d2d2b54264e77e3c8cb5bc866b40b32d5e2144a58b74c559c7e289f" +dependencies = [ + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-parser", + "cairo-lang-syntax", + "cairo-lang-utils", + "indent", + "indoc", + "itertools 0.12.1", + "rust-analyzer-salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-proc-macros" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33b5f4502b7efde6ac07fd5468f6dae15d88760aeece3d57a7bc4c224ba693e" +dependencies = [ + "cairo-lang-debug", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "cairo-lang-project" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63d6a3cc86a79a29978acaaf6f94738c5487e265247fe06c7bf359645d8c200" +dependencies = [ + "cairo-lang-filesystem", + "cairo-lang-utils", + "serde", + "smol_str", + "thiserror", + "toml", +] + +[[package]] +name = "cairo-lang-semantic" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c284031fd14796dad91483c3039d7929f8440e1e9e334017744b1d22df5aa8" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-parser", + "cairo-lang-plugins", + "cairo-lang-proc-macros", + "cairo-lang-syntax", + "cairo-lang-test-utils", + "cairo-lang-utils", + "id-arena", + "indoc", + "itertools 0.12.1", + "num-bigint", + "num-traits 0.2.19", + "rust-analyzer-salsa", + "smol_str", + "toml", +] + +[[package]] +name = "cairo-lang-sierra" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891488c1a3184ce91679f5bdb63015a1d24769a48bd07e5d51a1779d0031dfbe" +dependencies = [ + "anyhow", + "cairo-lang-utils", + "const-fnv1a-hash", + "convert_case", + "derivative", + "itertools 0.12.1", + "lalrpop", + "lalrpop-util", + "num-bigint", + "num-integer", + "num-traits 0.2.19", + "regex", + "rust-analyzer-salsa", + "serde", + "serde_json", + "sha3", + "smol_str", + "starknet-types-core", + "thiserror", +] + +[[package]] +name = "cairo-lang-sierra-generator" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5cc616e8df44c4d685fe3c5f81f35ebbda57225098b35cea8602457c45c9e96" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-lowering", + "cairo-lang-parser", + "cairo-lang-semantic", + "cairo-lang-sierra", + "cairo-lang-syntax", + "cairo-lang-utils", + "itertools 0.12.1", + "num-traits 0.2.19", + "rust-analyzer-salsa", + "serde", + "serde_json", + "smol_str", +] + +[[package]] +name = "cairo-lang-syntax" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7db0776c3d06cea65d7afe7a3c7685f6867eb6d951cf505caf35abfd1746773b" +dependencies = [ + "cairo-lang-debug", + "cairo-lang-filesystem", + "cairo-lang-utils", + "num-bigint", + "num-traits 0.2.19", + "rust-analyzer-salsa", + "smol_str", + "unescaper", +] + +[[package]] +name = "cairo-lang-syntax-codegen" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce0f7fa01c26cc731bc1d6350ac02fae91a68b5fdf60e684f991e861715adc4" +dependencies = [ + "genco", + "xshell", +] + +[[package]] +name = "cairo-lang-test-utils" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630a070a69c387eee9c0eda65e4f2508d129d4fbe081091077e661020ab95637" +dependencies = [ + "cairo-lang-formatter", + "cairo-lang-utils", + "colored", + "log", + "pretty_assertions", +] + +[[package]] +name = "cairo-lang-utils" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73104609a7d865e4cd1de9cbf4e750683d076b6d0233bf81be511df274a26916" +dependencies = [ + "hashbrown 0.14.5", + "indexmap 2.5.0", + "itertools 0.12.1", + "num-bigint", + "num-traits 0.2.19", + "schemars", + "serde", +] + [[package]] name = "cc" version = "1.1.15" @@ -115,6 +526,144 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "const-fnv1a-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "diffy" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e616e59155c92257e84970156f506287853355f58cd4a6eb167385722c32b790" +dependencies = [ + "nu-ansi-term", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + [[package]] name = "either" version = "1.13.0" @@ -122,145 +671,940 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] -name = "inkwell" -version = "0.5.0" +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "genco" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afac3cbb14db69ac9fef9cdb60d8a87e39a7a527f85a81a923436efa40ad42c6" +dependencies = [ + "genco-macros", + "relative-path", + "smallvec", +] + +[[package]] +name = "genco-macros" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553630feadf7b76442b0849fd25fdf89b860d933623aec9693fed19af0400c78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "globset" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "good_lp" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3198bd13dea84c76a64621d6ee8ee26a4960a9a0d538eca95ca8f1320a469ac9" +dependencies = [ + "fnv", + "minilp", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", + "serde", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "ignore" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indent" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f1a0777d972970f204fdf8ef319f1f4f8459131636d7e3c96c5d59570d0fa6" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "indoc" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" + +[[package]] +name = "inkwell" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40fb405537710d51f6bdbc8471365ddd4cd6d3a3c3ad6e0c8291691031ba94b2" +dependencies = [ + "either", + "inkwell_internals", + "libc", + "llvm-sys", + "once_cell", + "thiserror", +] + +[[package]] +name = "inkwell_internals" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd28cfd4cfba665d47d31c08a6ba637eed16770abca2eccbbc3ca831fef1e44" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lalrpop" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" +dependencies = [ + "ascii-canvas", + "bit-set", + "ena", + "itertools 0.11.0", + "lalrpop-util", + "petgraph", + "pico-args", + "regex", + "regex-syntax", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", + "walkdir", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "lambdaworks-crypto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb5d4f22241504f7c7b8d2c3a7d7835d7c07117f10bff2a7d96a9ef6ef217c3" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "llvm-sys" +version = "180.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778fa5fa02e32728e718f11eec147e6f134137399ab02fd2c13d32476337affa" +dependencies = [ + "anyhow", + "cc", + "lazy_static", + "libc", + "regex-lite", + "semver", +] + +[[package]] +name = "llvm-to-cairo" +version = "0.1.0" +dependencies = [ + "anyhow", + "ariadne", + "cairo-lang-compiler", + "cairo-lang-debug", + "cairo-lang-diagnostics", + "cairo-lang-eq-solver", + "cairo-lang-lowering", + "cairo-lang-semantic", + "cairo-lang-utils", + "clap", + "inkwell", + "itertools 0.13.0", + "miette", + "thiserror", + "tracing", +] + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matrixmultiply" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916806ba0031cd542105d916a97c8572e1fa6dd79c9c51e7eb43a09ec2dd84c1" +dependencies = [ + "rawpointer", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "miette" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" +dependencies = [ + "cfg-if", + "miette-derive", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "minilp" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82a7750a9e5076c660b7bec5e6457b4dbff402b9863c8d112891434e18fd5385" +dependencies = [ + "log", + "sprs", +] + +[[package]] +name = "ndarray" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac06db03ec2f46ee0ecdca1a1c34a99c0d188a0d83439b84bf0cb4b386e4ab09" +dependencies = [ + "matrixmultiply", + "num-complex", + "num-integer", + "num-traits 0.2.19", + "rawpointer", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits 0.2.19", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg", + "num-traits 0.2.19", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits 0.2.19", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +dependencies = [ + "num-traits 0.2.19", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "oorandom" +version = "11.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "path-clean" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.5.0", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "pretty_assertions" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "relative-path" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" + +[[package]] +name = "rust-analyzer-salsa" +version = "0.17.0-pre.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719825638c59fd26a55412a24561c7c5bcf54364c88b9a7a04ba08a6eafaba8d" +dependencies = [ + "indexmap 2.5.0", + "lock_api", + "oorandom", + "parking_lot", + "rust-analyzer-salsa-macros", + "rustc-hash", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "rust-analyzer-salsa-macros" +version = "0.17.0-pre.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d96498e9684848c6676c399032ebc37c52da95ecbefa83d71ccc53b9f8a4a8e" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schemars" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40fb405537710d51f6bdbc8471365ddd4cd6d3a3c3ad6e0c8291691031ba94b2" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" dependencies = [ - "either", - "inkwell_internals", - "libc", - "llvm-sys", - "once_cell", - "thiserror", + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", ] [[package]] -name = "inkwell_internals" -version = "0.10.0" +name = "schemars_derive" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd28cfd4cfba665d47d31c08a6ba637eed16770abca2eccbbc3ca831fef1e44" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" dependencies = [ "proc-macro2", "quote", - "syn", + "serde_derive_internals", + "syn 2.0.77", ] [[package]] -name = "is_terminal_polyfill" -version = "1.70.1" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "lazy_static" -version = "1.5.0" +name = "semver" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] [[package]] -name = "libc" -version = "0.2.158" +name = "serde" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] [[package]] -name = "llvm-sys" -version = "180.0.0" +name = "serde_derive" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778fa5fa02e32728e718f11eec147e6f134137399ab02fd2c13d32476337affa" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ - "anyhow", - "cc", - "lazy_static", - "libc", - "regex-lite", - "semver", + "proc-macro2", + "quote", + "syn 2.0.77", ] [[package]] -name = "llvm-to-cairo" -version = "0.1.0" +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ - "anyhow", - "ariadne", - "clap", - "inkwell", - "miette", - "thiserror", - "tracing", + "proc-macro2", + "quote", + "syn 2.0.77", ] [[package]] -name = "miette" -version = "7.2.0" +name = "serde_json" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", - "miette-derive", - "thiserror", - "unicode-width", + "cpufeatures", + "digest", ] [[package]] -name = "miette-derive" -version = "7.2.0" +name = "sha3" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "proc-macro2", - "quote", - "syn", + "digest", + "keccak", ] [[package]] -name = "once_cell" -version = "1.19.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "pin-project-lite" -version = "0.2.14" +name = "siphasher" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] -name = "proc-macro2" -version = "1.0.86" +name = "smallvec" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" dependencies = [ - "unicode-ident", + "serde", ] [[package]] -name = "quote" -version = "1.0.37" +name = "sprs" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "ec63571489873d4506683915840eeb1bb16b3198ee4894cc6f2fe3013d505e56" dependencies = [ - "proc-macro2", + "ndarray", + "num-complex", + "num-traits 0.1.43", ] [[package]] -name = "regex-lite" -version = "0.1.6" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "semver" -version = "1.0.23" +name = "starknet-types-core" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "lazy_static", + "num-bigint", + "num-integer", + "num-traits 0.2.19", + "serde", +] [[package]] -name = "shlex" -version = "1.3.0" +name = "string_cache" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared", + "precomputed-hash", +] [[package]] name = "strsim" @@ -268,6 +1612,17 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.77" @@ -279,6 +1634,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + [[package]] name = "thiserror" version = "1.0.63" @@ -296,7 +1662,50 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" +dependencies = [ + "indexmap 2.5.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] @@ -318,7 +1727,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] @@ -330,31 +1739,145 @@ dependencies = [ "once_cell", ] +[[package]] +name = "triomphe" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" +dependencies = [ + "serde", + "stable_deref_trait", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unescaper" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c878a167baa8afd137494101a688ef8c67125089ff2249284bd2b5f9bfedb815" +dependencies = [ + "thiserror", +] + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-width" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-xid" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" + [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -363,28 +1886,46 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -397,32 +1938,100 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +dependencies = [ + "memchr", +] + +[[package]] +name = "xshell" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db0ab86eae739efd1b054a8d3d16041914030ac4e01cd1dca0cf252fd8b6437" +dependencies = [ + "xshell-macros", +] + +[[package]] +name = "xshell-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852" + [[package]] name = "yansi" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] diff --git a/Cargo.toml b/Cargo.toml index 15c4425..c8653d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,12 +11,20 @@ keywords = ["compiler", "starknet", "starkware"] categories = ["compilers", "virtualization", "cryptography::cryptocurrencies"] edition = "2021" -rust-version = "1.80.1" +rust-version = "1.81.0" [dependencies] ariadne = "0.4.1" +cairo-lang-compiler = "2.8.2" +cairo-lang-debug = "2.8.2" +cairo-lang-diagnostics = "2.8.2" +cairo-lang-eq-solver = "2.8.2" +cairo-lang-lowering = "2.8.2" +cairo-lang-semantic = "2.8.2" +cairo-lang-utils = "2.8.2" clap = "4.5.16" inkwell = { version = "0.5.0", features = ["llvm18-0"] } +itertools = "0.13.0" miette = "7.2.0" thiserror = "1.0.63" tracing = "0.1.40" @@ -25,6 +33,10 @@ tracing = "0.1.40" anyhow = "1.0.86" [profile.release] -debug = true # Include full debug information in release builds. -overflow-checks = true # Keep overflow checks in production builds. -lto = "thin" # Thin LTO performs cross-crate LTO while not bloating the build time too much. +debug = true # Include full debug information in release builds. +overflow-checks = true # Keep overflow checks in production builds. +lto = "thin" # Thin LTO performs cheaper cross-crate LTO. + +[[bin]] +name = "ltc" # Named for Llvm-To-Cairo +path = "src/bin/main.rs" diff --git a/README.md b/README.md index f64b453..4f0f143 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@ This repository contains the efforts to enable compilation of LLVM bytecode to r goals of this project are threefold: 1. **Provable Rust Execution:** To provide the ability to prove the execution of LLVM bytecode using - Starknet's proving infrastructure, thereby allowing verification of said execution. + Starknet's proving infrastructure, thereby allowing verification of said execution. 2. **Writing Contracts in LLVM Languages:** To provide the ability to write contracts for execution on Starknet using any language that compiles to LLVM (while recognizing that this will require a small per-language effort). 3. **Using Foreign Libraries from Cairo:** There exist a wealth of useful cryptographic libraries in - languages such as Rust that compile to LLVM. Rather than requiring users to reimplement them in + languages such as Rust that compile to LLVM. Rather than requiring users to reimplement them in [Cairo](https://www.cairo-lang.org), this effort would allow them to be exposed directly. The initial efforts for this project are focusing on using [Rust](https://rust-lang.org) as the @@ -23,8 +23,8 @@ the language-specific libraries. As there is a significant mismatch between the computational model expected by LLVM, and the Cairo model of execution, we take a multi-layered approach. -- **Compilation:** Where there is a direct correspondence between LLVM and Cairo's semantics, we can - perform direct compilation, generating Cairo's `FlatLowered` IR from LLVM IR. +- **Compilation:** Where there is a direct correspondence between LLVM and Cairo's semantics, we can + perform direct compilation, generating Cairo's `FlatLowered` IR from LLVM IR. - **Polyfills:** Where there is a mismatch, we have to implement the mismatched operation as an _emulation_ or a _polyfill_. These will implement the expected semantics (often given by [compiler-rt](https://compiler-rt.llvm.org)) as Cairo code that can then be called into by the diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 6598be7..b593d16 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,23 +1,23 @@ # Contributing -This document exists as a brief introduction to how you can contribute to the LLVM to Cairo -project. It includes a guide to [getting started](#setting-up-for-development) and -[contributing to `main`](#getting-your-work-on-main). +This document exists as a brief introduction to how you can contribute to the LLVM to Cairo project. +It includes a guide to [getting started](#setting-up-for-development) and +[contributing to `main`](#getting-your-work-on-main). -This repository is written in [Rust](https://www.rust-lang.org), a high-performance and -low-level language with a smart compiler that helps to write reliable and fast software. If you -haven't worked with Rust before, take a look at the ["New to Rust?"](#new-to-rust) section below! +This repository is written in [Rust](https://www.rust-lang.org), a high-performance and low-level +language with a smart compiler that helps to write reliable and fast software. If you haven't worked +with Rust before, take a look at the ["New to Rust?"](#new-to-rust) section below! ## Setting Up for Development Unfortunately the complexity of having LLVM available for building this project means that we have to be a bit careful with our environment setup. We recommend using [lix](https://lix.systems) to -work with the flake configuration included in the repository. +work with the flake configuration included in the repository. We assume that you are either running on linux or macOS at this stage. 1. Install [lix](https://lix.systems/install/) using the lix installer—you will want to say "yes" - when asked if you want to enable flakes—and make sure that you can successfully run the `nix` + when asked if you want to enable flakes—and make sure that you can successfully run the `nix` command. ```shell @@ -37,14 +37,28 @@ We assume that you are either running on linux or macOS at this stage. ```shell git clone git@github.com:reilabs/llvm-to-cairo.git ``` - -3. Enter the cloned directory (`cd llvm-to-cairo`) and launch a development shell using + +3. Enter the cloned directory (`cd llvm-to-cairo`) and launch a development shell using `nix develop`. This will launch into your default shell, but you can override this by running `nix develop ".#ci" --command ` to use the CI dev shell instead. 4. Within this shell you are able to run Cargo commands such as `cargo build`, which will build the project, or `cargo test` which will run the tests. - + +### Pre-Commit Hooks + +In order to ensure uniform formatting we use a series of precommit hooks that run things like +linters and other checks before things get committed. + +1. **Set Up:** Run `npm install`. This will install and set up the hooks that run before every + commit. +2. **Test:** When you run `git commit`, you will see a progress indicator show up that gives insight + into the linting and formatting processes that are running. If any of these fail, then + +In order to run these hooks you will either need to be within the `nix develop` shell, which +provides all of these, or to have the following installed and available on your path: `nodejs`, +`npm` and `npx`, and both `rustfmt` and `clippy`. + ### Setting Up Your IDE Due to the complexities of getting some IDEs to work with nix-based Rust projects, we recommend @@ -53,20 +67,27 @@ using a system-wide installation of the correct toolchain (as specified in provided by `nix develop`, as this will give it the correct environment variables to find the LLVM install. -We cannot provide instructions for _all_ IDEs, but for those using RustRover you will need to go to -the top-level "Rust" section in settings, and point both "Toolchain location" and "Standard library" -to a system-level install of both. For example: +We cannot provide instructions for all IDEs out of the box, but please feel free to add instructions +for your own IDE or editor here if you are working on the project. + +#### RustRover + +For those using RustRover you will need to go to the top-level "Rust" section in settings, and point +both "Toolchain location" and "Standard library" to a **system-level install** of both. For example: ```text Toolchain Location = /Users//.rustup/toolchains/stable-platform-here/bin Standard library = /Users//.rustup/toolchains/stable-platform-here/lib/rustlib/src/rust ``` +Specifically do not point to the locations provided by `nix` for the development shell, as RustRover +seems to have issues with these. + ## Getting Your Work on `main` For contributions this repository works on a -[Pull Request](https://github.com/reilabs/llvm-to-cairo/pulls) and subsequent review -model, supported by CI to check that things avoid being broken. The process works as follows: +[Pull Request](https://github.com/reilabs/llvm-to-cairo/pulls) and subsequent review model, +supported by CI to check that things avoid being broken. The process works as follows: 1. If necessary, you fork the repository, but if you have access please create a branch. 2. You make your changes on that branch. @@ -77,21 +98,21 @@ model, supported by CI to check that things avoid being broken. The process work ## New to Rust? If you are new to working with Rust, a great place to start is the official -[Rust Book](https://doc.rust-lang.org/book/). It gives a great overview of the language and -general style. It's also worth getting familiar with the following tools: +[Rust Book](https://doc.rust-lang.org/book/). It gives a great overview of the language and general +style. It's also worth getting familiar with the following tools: - [Rustup](https://rustup.rs), the Rust toolchain installer. - [Cargo](https://doc.rust-lang.org/cargo/), the Rust build tool and package manager. - [docs.rs](https://docs.rs), a site providing up-to-date crate (package) documentation for all packages published to [crates.io](https://crates.io), the official package registry. -- [Rustdoc](https://doc.rust-lang.org/rustdoc/index.html), the ecosystem's official - documentation tool. +- [Rustdoc](https://doc.rust-lang.org/rustdoc/index.html), the ecosystem's official documentation + tool. In terms of development tooling, there are two major options in this space. - [Rust Analyzer](https://rust-analyzer.github.io) is the official implementation of the - [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) for Rust, - and will work with any LSP compatible host. + [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) for Rust, and + will work with any LSP compatible host. - [RustRover](https://www.jetbrains.com/rust/) is the fully-featured JetBrains IDE for working with Rust in single- and multi-language projects. The Rust support plugin can also run in other JetBrains IDEs if needed. diff --git a/docs/Getting LLVM IR Output.md b/docs/Getting LLVM IR Output.md new file mode 100644 index 0000000..a39d03c --- /dev/null +++ b/docs/Getting LLVM IR Output.md @@ -0,0 +1,23 @@ +# Getting LLVM IR Output + +Most toolchains that compile their source language using LLVM have a means by which they can output +LLVM IR instead of completing the compilation process to the target machine. This document exists as +a quick record of how to get such output from the various source languages we are working with in +this project. + +## Rust + +`rustc` will emit LLVM IR when passed the `--emit=llvm-ir` flag. This will output `.ll` files into +the `target` directory corresponding to your compiled file. For more information, see the +[`rustc` developer guide](https://rustc-dev-guide.rust-lang.org/backend/debugging.html). + +- This can be passed to the correct compiler when using cargo by calling + `cargo rustc -- --emit=llvm-ir`. +- You can also set the `RUSTC_FLAGS` environment variable before invoking cargo as normal: + `RUSTFLAGS='--emit=llvm-ir'`. + +There are some difficulties here with multiple-unit compilation that need to be figured out, but +this is a reasonable starting point. + +For individual functions and compilation units, there is also the `cargo llvm-ir` command, which can +be run after installing `cargo-asm` (`cargo install cargo-asm`). diff --git a/flake.lock b/flake.lock index d85597f..6788922 100644 --- a/flake.lock +++ b/flake.lock @@ -17,9 +17,7 @@ }, "fenix": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ], + "nixpkgs": ["nixpkgs"], "rust-analyzer-src": "rust-analyzer-src" }, "locked": { diff --git a/flake.nix b/flake.nix index 1a8bf81..4b4dca3 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ fenixLib = fenix.packages.${system}; fenixStable = fenixLib.fromToolchainName { name = rustVersion; - sha256 = "sha256-3jVIIf5XPnUU1CRaTyAiO0XHVbJl12MSx3eucTXCjtE="; + sha256 = "sha256-VZZnlyP69+Y3crrLHQyJirqlHrTtGTsyiSnZB8jEvVo="; }; # As we want nightly Rustfmt, we have to build a custom toolchain. @@ -68,6 +68,10 @@ llvmToCairo ]; + packages = [ + pkgs.nodejs_22 + ]; + shellHook = '' exec $(${getUserShellCommand}) ''; diff --git a/main b/main new file mode 100755 index 0000000..fbe7dc6 Binary files /dev/null and b/main differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..43ebda2 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "devDependencies": { + "husky": "^9.1.6", + "lint-staged": "^15.2.10", + "prettier": "3.3.3", + "prettier-plugin-toml": "2.0.1" + }, + "lint-staged": { + "(*.md|*.toml|*.json|*.yaml|*.yml|*.css|*.js|*.ts)": [ + "prettier --write" + ] + }, + "husky": { + "hooks": { + "pre-commit": "npx lint-staged && cargo clippy -- -D warnings" + } + }, + "scripts": { + "prepare": "husky" + } +} diff --git a/src/bin/main.rs b/src/bin/main.rs new file mode 100644 index 0000000..0c954d2 --- /dev/null +++ b/src/bin/main.rs @@ -0,0 +1,10 @@ +//! This is the CLI driver for the compilation of LLVM IR to Cairo. For more +//! detail, please see the crate documentation [`llvm_to_cairo`]. + +#![warn(clippy::all, clippy::cargo, clippy::pedantic)] +#![allow(clippy::module_name_repetitions)] // Allows for better API naming +#![allow(clippy::multiple_crate_versions)] // Enforced by our dependencies + +fn main() { + println!("Hello, world!"); +} diff --git a/src/error/llvm_compile.rs b/src/error/llvm_compile.rs new file mode 100644 index 0000000..004c866 --- /dev/null +++ b/src/error/llvm_compile.rs @@ -0,0 +1,12 @@ +//! Error types and utilities to do with the compilation from LLVM IR to Cairo +//! IR. + +use thiserror::Error; + +/// This error type is for use during the process of compilation from LLVM IR to +/// the Cairo IR. +#[derive(Clone, Debug, Error)] +pub enum Error { + #[error("Miscellaneous compilation error: {_0}")] + Miscellaneous(String), +} diff --git a/src/error/mod.rs b/src/error/mod.rs new file mode 100644 index 0000000..eacabb8 --- /dev/null +++ b/src/error/mod.rs @@ -0,0 +1,33 @@ +//! Error handling types and utilities. +//! +//! # Error Conventions +//! +//! As we are providing a library that others may want to interact with from +//! _code_ as well as from the CLI driver, we keep our errors strongly typed at +//! all times. While libraries like +//! [anyhow](https://docs.rs/anyhow/latest/anyhow/) are well-suited for +//! application code, they make it more difficult than is necessary to handle +//! specific errors in library code. To that end, we make sure that our errors +//! are kept strongly typed within the library as much as is possible. + +pub mod llvm_compile; + +use thiserror::Error; + +/// The result type to be used at the boundaries of the library. +pub type Result = std::result::Result; + +/// The root of the error hierarchy for this crate. +/// +/// All errors should be able to be implicitly converted to this error type as +/// this is the type that is used at the boundaries of the library. Though we do +/// not make a habit of hiding things, any function intended to be part of the +/// _truly_ public interface of this library should return this error type. +#[derive(Clone, Debug, Error)] +pub enum Error { + #[error(transparent)] + LlvmCompile(#[from] llvm_compile::Error), + + #[error("An unknown error occurred: {_0}")] + Miscellaneous(String), +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..be3a097 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,23 @@ +//! This library implements the functionality necessary for the compilation of +//! [LLVM IR](https://llvm.org/docs/LangRef.html) to the +//! [Cairo](https://www.cairo-lang.org) programming language in order to enable +//! the execution of LLVM-compiled languages on top of the +//! [CairoVM](https://github.com/lambdaclass/cairo-vm) and hence on +//! [Starknet](https://www.starknet.io). +//! +//! The goals of this project are twofold: +//! +//! 1. To enable writing contracts in languages that compile to LLVM. +//! 2. To enable use of libraries in such languages as part of the Cairo +//! ecosystem. +//! +//! The major focus in the initial phases of the project is on using +//! [Rust](https://rust-lang.org) as the source language, but the goal is to +//! eventually support _any_ major language (Swift, C++, and so on) that can +//! target LLVM. + +#![warn(clippy::all, clippy::cargo, clippy::pedantic)] +#![allow(clippy::module_name_repetitions)] // Allows for better API naming +#![allow(clippy::multiple_crate_versions)] // Enforced by our dependencies + +pub mod error; diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 013f290..0000000 --- a/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![warn(clippy::all, clippy::cargo, clippy::pedantic)] -#![allow(clippy::module_name_repetitions)] // Allows for better API naming - -fn main() { - println!("Hello, world!"); -}