diff --git a/Cargo.lock b/Cargo.lock index 38289fe4f2..a4b4327c80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,17 +36,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.4", - "once_cell", - "version_check", -] - [[package]] name = "aho-corasick" version = "0.7.18" @@ -188,24 +177,12 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base58" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" - [[package]] name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" -[[package]] -name = "bech32" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" - [[package]] name = "bincode" version = "1.3.3" @@ -357,19 +334,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "serde", - "winapi 0.3.9", -] - [[package]] name = "ci_info" version = "0.10.2" @@ -607,36 +571,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "curl" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de97b894edd5b5bcceef8b78d7da9b75b1d2f2f9a910569d0bde3dd31d84939" -dependencies = [ - "curl-sys", - "libc", - "openssl-probe", - "openssl-sys", - "schannel", - "socket2", - "winapi 0.3.9", -] - -[[package]] -name = "curl-sys" -version = "0.4.52+curl-7.81.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b8c2d1023ea5fded5b7b892e4b8e95f70038a421126a056761a84246a28971" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", - "winapi 0.3.9", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1052,9 +986,6 @@ name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] [[package]] name = "heck" @@ -1384,39 +1315,9 @@ dependencies = [ name = "leo-compiler" version = "1.5.3" dependencies = [ - "bech32", - "bincode", - "indexmap", - "leo-asg", - "leo-asg-passes", "leo-ast", - "leo-ast-passes", "leo-errors", - "leo-imports", - "leo-input", - "leo-package", "leo-parser", - "leo-synthesizer", - "leo-test-framework", - "num-bigint", - "pest", - "rand 0.8.4", - "rand_core 0.6.3", - "rand_xorshift", - "serde", - "serde_json", - "serde_yaml", - "sha2", - "snarkvm-algorithms", - "snarkvm-curves", - "snarkvm-dpc", - "snarkvm-fields", - "snarkvm-gadgets", - "snarkvm-r1cs", - "snarkvm-utilities", - "tempfile", - "tendril", - "tracing", ] [[package]] @@ -1615,18 +1516,6 @@ version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" -[[package]] -name = "libz-sys" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linked-hash-map" version = "0.5.4" @@ -1972,12 +1861,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "paste" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -2284,15 +2167,6 @@ dependencies = [ "rand_core 0.6.3", ] -[[package]] -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core 0.6.3", -] - [[package]] name = "rayon" version = "1.5.1" @@ -2714,38 +2588,6 @@ dependencies = [ "syn 1.0.86", ] -[[package]] -name = "snarkvm-dpc" -version = "0.7.5" -source = "git+https://github.com/AleoHQ/snarkVM.git?rev=51633e2#51633e2fac247bc829bd316a93f59b6ba0759661" -dependencies = [ - "anyhow", - "base58", - "bech32", - "bincode", - "blake2", - "chrono", - "derivative", - "hex", - "itertools 0.10.3", - "once_cell", - "rand 0.8.4", - "rayon", - "serde", - "serde_json", - "snarkvm-algorithms", - "snarkvm-curves", - "snarkvm-fields", - "snarkvm-gadgets", - "snarkvm-marlin", - "snarkvm-parameters", - "snarkvm-polycommit", - "snarkvm-profiler", - "snarkvm-r1cs", - "snarkvm-utilities", - "thiserror", -] - [[package]] name = "snarkvm-fields" version = "0.7.5" @@ -2780,70 +2622,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "snarkvm-marlin" -version = "0.7.5" -source = "git+https://github.com/AleoHQ/snarkVM.git?rev=51633e2#51633e2fac247bc829bd316a93f59b6ba0759661" -dependencies = [ - "bincode", - "blake2", - "derivative", - "digest 0.9.0", - "hashbrown", - "rand 0.8.4", - "rand_chacha 0.3.1", - "rand_core 0.6.3", - "rayon", - "serde", - "smallvec", - "snarkvm-algorithms", - "snarkvm-curves", - "snarkvm-fields", - "snarkvm-gadgets", - "snarkvm-polycommit", - "snarkvm-profiler", - "snarkvm-r1cs", - "snarkvm-utilities", -] - -[[package]] -name = "snarkvm-parameters" -version = "0.7.5" -source = "git+https://github.com/AleoHQ/snarkVM.git?rev=51633e2#51633e2fac247bc829bd316a93f59b6ba0759661" -dependencies = [ - "aleo-std", - "anyhow", - "cfg-if 1.0.0", - "curl", - "hex", - "paste", - "serde_json", - "snarkvm-algorithms", - "snarkvm-utilities", - "thiserror", -] - -[[package]] -name = "snarkvm-polycommit" -version = "0.7.5" -source = "git+https://github.com/AleoHQ/snarkVM.git?rev=51633e2#51633e2fac247bc829bd316a93f59b6ba0759661" -dependencies = [ - "derivative", - "digest 0.9.0", - "hashbrown", - "itertools 0.10.3", - "rand 0.8.4", - "rand_core 0.6.3", - "rayon", - "snarkvm-algorithms", - "snarkvm-curves", - "snarkvm-fields", - "snarkvm-gadgets", - "snarkvm-profiler", - "snarkvm-r1cs", - "snarkvm-utilities", -] - [[package]] name = "snarkvm-profiler" version = "0.7.5" diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index d3310ea599..fc6698ad3e 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -26,129 +26,10 @@ version = "1.5.3" path = "../errors" version = "1.5.3" -[dependencies.leo-imports] -path = "../imports" -version = "1.5.3" - -[dependencies.leo-input] -path = "../input" -version = "1.5.3" - -[dependencies.leo-package] -path = "../package" -version = "1.5.3" - -#[dependencies.leo-state] -#path = "../state" -#version = "1.5.3" - -[dependencies.leo-asg] -path = "../asg" -version = "1.5.3" - [dependencies.leo-parser] path = "../parser" version = "1.5.3" -[dependencies.leo-asg-passes] -path = "../asg-passes" -version = "1.5.3" - -[dependencies.leo-ast-passes] -path = "../ast-passes" -version = "1.5.3" - -[dependencies.leo-synthesizer] -path = "../synthesizer" -version = "1.5.3" - -[dev-dependencies.snarkvm-algorithms] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" -default-features = false - -[dependencies.snarkvm-curves] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" -default-features = false - -[dependencies.snarkvm-fields] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" -default-features = false - -[dependencies.snarkvm-dpc] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" -features = ["testnet2"] - -[dependencies.snarkvm-gadgets] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" -default-features = false -features = [ "curves" ] - -[dependencies.snarkvm-r1cs] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" -default-features = false - -[dependencies.snarkvm-utilities] -git = "https://github.com/AleoHQ/snarkVM.git" -rev = "51633e2" - -[dependencies.bech32] -version = "0.8" - -[dependencies.bincode] -version = "1.3" - -[dependencies.indexmap] -version = "1.8.0" -features = [ "serde-1" ] - -[dependencies.num-bigint] -version = "0.4" - -[dependencies.pest] -version = "2.0" - -[dependencies.rand] -version = "0.8" - -[dependencies.serde] -version = "1.0" - -[dependencies.serde_json] -version = "1.0" -features = [ "preserve_order" ] - -[dependencies.sha2] -version = "0.10" - -[dependencies.tendril] -version = "0.4" - -[dependencies.tracing] -version = "0.1" - -[dev-dependencies.leo-test-framework] -path = "../test-framework" -version = "1.4.0" - -[dev-dependencies.rand_core] -version = "0.6.3" - -[dev-dependencies.rand_xorshift] -version = "0.3" -default-features = false - -[dev-dependencies.serde_yaml] -version = "0.8" - -[dev-dependencies.tempfile] -version = "3.3.0" - [features] default = [ ] ci_skip = [ "leo-ast/ci_skip" ] diff --git a/compiler/src/lib.rs b/compiler/src/lib.rs index d020bfb780..861dc8d30a 100644 --- a/compiler/src/lib.rs +++ b/compiler/src/lib.rs @@ -22,45 +22,44 @@ #![allow(clippy::upper_case_acronyms)] #![doc = include_str!("../README.md")] -pub mod compiler; +use leo_errors::emitter::Handler; +use leo_errors::{CompilerError, Result}; -pub mod console; -pub use console::*; +use std::fs; +use std::path::PathBuf; -pub mod constraints; -pub use constraints::*; +/// The primary entry point of the Leo compiler. +pub struct RunCompiler<'a> { + handler: &'a Handler, + main_file_path: PathBuf, +} -pub mod definition; +impl<'a> RunCompiler<'a> { + /// + /// Returns a new Leo compiler. + /// + pub fn new(handler: &'a Handler, main_file_path: PathBuf) -> Self { + Self { + handler, + main_file_path, + } + } -pub mod expression; -pub use expression::*; + /// + /// Returns a compiled Leo program. + /// + pub fn run(self) -> Result { + // Load the program file. + let program_string = fs::read_to_string(&self.main_file_path) + .map_err(|e| CompilerError::file_read_error(self.main_file_path.clone(), e))?; -pub mod function; -pub use function::*; + // Use the parser to construct the abstract syntax tree (ast). + let ast: leo_ast::Ast = leo_parser::parse_ast( + self.handler, + self.main_file_path.to_str().unwrap_or_default(), + program_string, + )?; -pub mod output; -pub use output::*; - -pub mod program; -pub use program::*; - -pub mod statement; -pub use statement::*; - -pub mod prelude; -pub use prelude::*; - -pub mod value; -pub use value::*; - -pub mod phase; -pub use phase::*; - -pub mod phases; -pub use phases::*; - -pub mod option; -pub use option::*; - -#[cfg(test)] -mod test; + Ok(ast) + } +} diff --git a/compiler/src/unused/Cargo.toml b/compiler/src/unused/Cargo.toml new file mode 100644 index 0000000000..f775271447 --- /dev/null +++ b/compiler/src/unused/Cargo.toml @@ -0,0 +1,146 @@ +[package] +name = "leo-compiler" +version = "1.5.3" +authors = [ "The Aleo Team " ] +description = "Compiler of the Leo programming language" +homepage = "https://aleo.org" +repository = "https://github.com/AleoHQ/leo" +keywords = [ + "aleo", + "cryptography", + "leo", + "programming-language", + "zero-knowledge" +] +categories = [ "cryptography::cryptocurrencies", "web-programming" ] +include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ] +license = "GPL-3.0" +edition = "2021" +rust-version = "1.56.1" + +[dependencies.leo-ast] +path = "../ast" +version = "1.5.3" + +[dependencies.leo-errors] +path = "../errors" +version = "1.5.3" +# +#[dependencies.leo-imports] +#path = "../imports" +#version = "1.5.3" +# +#[dependencies.leo-input] +#path = "../input" +#version = "1.5.3" +# +#[dependencies.leo-package] +#path = "../package" +#version = "1.5.3" + +[dependencies.leo-parser] +path = "../parser" +version = "1.5.3" +# +#[dependencies.leo-asg-passes] +#path = "../asg-passes" +#version = "1.5.3" +# +#[dependencies.leo-ast-passes] +#path = "../ast-passes" +#version = "1.5.3" +# +#[dependencies.leo-synthesizer] +#path = "../synthesizer" +#version = "1.5.3" + +[dev-dependencies.snarkvm-algorithms] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" +default-features = false + +[dependencies.snarkvm-curves] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" +default-features = false + +[dependencies.snarkvm-fields] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" +default-features = false + +[dependencies.snarkvm-dpc] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" +features = ["testnet2"] + +[dependencies.snarkvm-gadgets] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" +default-features = false +features = [ "curves" ] + +[dependencies.snarkvm-r1cs] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" +default-features = false + +[dependencies.snarkvm-utilities] +git = "https://github.com/AleoHQ/snarkVM.git" +rev = "51633e2" + +[dependencies.bech32] +version = "0.8" + +[dependencies.bincode] +version = "1.3" + +[dependencies.indexmap] +version = "1.8.0" +features = [ "serde-1" ] + +[dependencies.num-bigint] +version = "0.4" + +[dependencies.pest] +version = "2.0" + +[dependencies.rand] +version = "0.8" + +[dependencies.serde] +version = "1.0" + +[dependencies.serde_json] +version = "1.0" +features = [ "preserve_order" ] + +[dependencies.sha2] +version = "0.10" + +[dependencies.tendril] +version = "0.4" + +[dependencies.tracing] +version = "0.1" + +[dev-dependencies.leo-test-framework] +path = "../test-framework" +version = "1.4.0" + +[dev-dependencies.rand_core] +version = "0.6.3" + +[dev-dependencies.rand_xorshift] +version = "0.3" +default-features = false + +[dev-dependencies.serde_yaml] +version = "0.8" + +[dev-dependencies.tempfile] +version = "3.3.0" + +[features] +default = [ ] +ci_skip = [ "leo-ast/ci_skip" ] diff --git a/compiler/src/compiler.rs b/compiler/src/unused/compiler.rs similarity index 99% rename from compiler/src/compiler.rs rename to compiler/src/unused/compiler.rs index 9b29404382..969cf8bec0 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/unused/compiler.rs @@ -27,7 +27,6 @@ use leo_imports::ImportParser; use leo_input::LeoInputParser; use leo_package::inputs::InputPairs; use leo_parser::parse_ast; -// use leo_state::verify_local_data_commitment; use snarkvm_fields::PrimeField; use snarkvm_r1cs::{ConstraintSynthesizer, ConstraintSystem, SynthesisError}; diff --git a/compiler/src/console/assert.rs b/compiler/src/unused/console/assert.rs similarity index 100% rename from compiler/src/console/assert.rs rename to compiler/src/unused/console/assert.rs diff --git a/compiler/src/console/console.rs b/compiler/src/unused/console/console.rs similarity index 100% rename from compiler/src/console/console.rs rename to compiler/src/unused/console/console.rs diff --git a/compiler/src/console/format.rs b/compiler/src/unused/console/format.rs similarity index 100% rename from compiler/src/console/format.rs rename to compiler/src/unused/console/format.rs diff --git a/compiler/src/console/mod.rs b/compiler/src/unused/console/mod.rs similarity index 100% rename from compiler/src/console/mod.rs rename to compiler/src/unused/console/mod.rs diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/unused/constraints/constraints.rs similarity index 100% rename from compiler/src/constraints/constraints.rs rename to compiler/src/unused/constraints/constraints.rs diff --git a/compiler/src/constraints/mod.rs b/compiler/src/unused/constraints/mod.rs similarity index 100% rename from compiler/src/constraints/mod.rs rename to compiler/src/unused/constraints/mod.rs diff --git a/compiler/src/definition/definition.rs b/compiler/src/unused/definition/definition.rs similarity index 100% rename from compiler/src/definition/definition.rs rename to compiler/src/unused/definition/definition.rs diff --git a/compiler/src/definition/mod.rs b/compiler/src/unused/definition/mod.rs similarity index 100% rename from compiler/src/definition/mod.rs rename to compiler/src/unused/definition/mod.rs diff --git a/compiler/src/expression/arithmetic/add.rs b/compiler/src/unused/expression/arithmetic/add.rs similarity index 100% rename from compiler/src/expression/arithmetic/add.rs rename to compiler/src/unused/expression/arithmetic/add.rs diff --git a/compiler/src/expression/arithmetic/bit_not.rs b/compiler/src/unused/expression/arithmetic/bit_not.rs similarity index 100% rename from compiler/src/expression/arithmetic/bit_not.rs rename to compiler/src/unused/expression/arithmetic/bit_not.rs diff --git a/compiler/src/expression/arithmetic/div.rs b/compiler/src/unused/expression/arithmetic/div.rs similarity index 100% rename from compiler/src/expression/arithmetic/div.rs rename to compiler/src/unused/expression/arithmetic/div.rs diff --git a/compiler/src/expression/arithmetic/mod.rs b/compiler/src/unused/expression/arithmetic/mod.rs similarity index 100% rename from compiler/src/expression/arithmetic/mod.rs rename to compiler/src/unused/expression/arithmetic/mod.rs diff --git a/compiler/src/expression/arithmetic/mul.rs b/compiler/src/unused/expression/arithmetic/mul.rs similarity index 100% rename from compiler/src/expression/arithmetic/mul.rs rename to compiler/src/unused/expression/arithmetic/mul.rs diff --git a/compiler/src/expression/arithmetic/negate.rs b/compiler/src/unused/expression/arithmetic/negate.rs similarity index 100% rename from compiler/src/expression/arithmetic/negate.rs rename to compiler/src/unused/expression/arithmetic/negate.rs diff --git a/compiler/src/expression/arithmetic/pow.rs b/compiler/src/unused/expression/arithmetic/pow.rs similarity index 100% rename from compiler/src/expression/arithmetic/pow.rs rename to compiler/src/unused/expression/arithmetic/pow.rs diff --git a/compiler/src/expression/arithmetic/sub.rs b/compiler/src/unused/expression/arithmetic/sub.rs similarity index 100% rename from compiler/src/expression/arithmetic/sub.rs rename to compiler/src/unused/expression/arithmetic/sub.rs diff --git a/compiler/src/expression/array/access.rs b/compiler/src/unused/expression/array/access.rs similarity index 100% rename from compiler/src/expression/array/access.rs rename to compiler/src/unused/expression/array/access.rs diff --git a/compiler/src/expression/array/array.rs b/compiler/src/unused/expression/array/array.rs similarity index 100% rename from compiler/src/expression/array/array.rs rename to compiler/src/unused/expression/array/array.rs diff --git a/compiler/src/expression/array/index.rs b/compiler/src/unused/expression/array/index.rs similarity index 100% rename from compiler/src/expression/array/index.rs rename to compiler/src/unused/expression/array/index.rs diff --git a/compiler/src/expression/array/mod.rs b/compiler/src/unused/expression/array/mod.rs similarity index 100% rename from compiler/src/expression/array/mod.rs rename to compiler/src/unused/expression/array/mod.rs diff --git a/compiler/src/expression/binary/binary.rs b/compiler/src/unused/expression/binary/binary.rs similarity index 100% rename from compiler/src/expression/binary/binary.rs rename to compiler/src/unused/expression/binary/binary.rs diff --git a/compiler/src/expression/binary/mod.rs b/compiler/src/unused/expression/binary/mod.rs similarity index 100% rename from compiler/src/expression/binary/mod.rs rename to compiler/src/unused/expression/binary/mod.rs diff --git a/compiler/src/expression/circuit/access.rs b/compiler/src/unused/expression/circuit/access.rs similarity index 100% rename from compiler/src/expression/circuit/access.rs rename to compiler/src/unused/expression/circuit/access.rs diff --git a/compiler/src/expression/circuit/circuit.rs b/compiler/src/unused/expression/circuit/circuit.rs similarity index 100% rename from compiler/src/expression/circuit/circuit.rs rename to compiler/src/unused/expression/circuit/circuit.rs diff --git a/compiler/src/expression/circuit/mod.rs b/compiler/src/unused/expression/circuit/mod.rs similarity index 100% rename from compiler/src/expression/circuit/mod.rs rename to compiler/src/unused/expression/circuit/mod.rs diff --git a/compiler/src/expression/conditional/conditional.rs b/compiler/src/unused/expression/conditional/conditional.rs similarity index 100% rename from compiler/src/expression/conditional/conditional.rs rename to compiler/src/unused/expression/conditional/conditional.rs diff --git a/compiler/src/expression/conditional/mod.rs b/compiler/src/unused/expression/conditional/mod.rs similarity index 100% rename from compiler/src/expression/conditional/mod.rs rename to compiler/src/unused/expression/conditional/mod.rs diff --git a/compiler/src/expression/expression.rs b/compiler/src/unused/expression/expression.rs similarity index 100% rename from compiler/src/expression/expression.rs rename to compiler/src/unused/expression/expression.rs diff --git a/compiler/src/expression/function/core_circuit.rs b/compiler/src/unused/expression/function/core_circuit.rs similarity index 100% rename from compiler/src/expression/function/core_circuit.rs rename to compiler/src/unused/expression/function/core_circuit.rs diff --git a/compiler/src/expression/function/function.rs b/compiler/src/unused/expression/function/function.rs similarity index 100% rename from compiler/src/expression/function/function.rs rename to compiler/src/unused/expression/function/function.rs diff --git a/compiler/src/expression/function/mod.rs b/compiler/src/unused/expression/function/mod.rs similarity index 100% rename from compiler/src/expression/function/mod.rs rename to compiler/src/unused/expression/function/mod.rs diff --git a/compiler/src/expression/logical/and.rs b/compiler/src/unused/expression/logical/and.rs similarity index 100% rename from compiler/src/expression/logical/and.rs rename to compiler/src/unused/expression/logical/and.rs diff --git a/compiler/src/expression/logical/mod.rs b/compiler/src/unused/expression/logical/mod.rs similarity index 100% rename from compiler/src/expression/logical/mod.rs rename to compiler/src/unused/expression/logical/mod.rs diff --git a/compiler/src/expression/logical/not.rs b/compiler/src/unused/expression/logical/not.rs similarity index 100% rename from compiler/src/expression/logical/not.rs rename to compiler/src/unused/expression/logical/not.rs diff --git a/compiler/src/expression/logical/or.rs b/compiler/src/unused/expression/logical/or.rs similarity index 100% rename from compiler/src/expression/logical/or.rs rename to compiler/src/unused/expression/logical/or.rs diff --git a/compiler/src/expression/mod.rs b/compiler/src/unused/expression/mod.rs similarity index 100% rename from compiler/src/expression/mod.rs rename to compiler/src/unused/expression/mod.rs diff --git a/compiler/src/expression/operator/lengthof.rs b/compiler/src/unused/expression/operator/lengthof.rs similarity index 100% rename from compiler/src/expression/operator/lengthof.rs rename to compiler/src/unused/expression/operator/lengthof.rs diff --git a/compiler/src/expression/operator/mod.rs b/compiler/src/unused/expression/operator/mod.rs similarity index 100% rename from compiler/src/expression/operator/mod.rs rename to compiler/src/unused/expression/operator/mod.rs diff --git a/compiler/src/expression/relational/eq.rs b/compiler/src/unused/expression/relational/eq.rs similarity index 100% rename from compiler/src/expression/relational/eq.rs rename to compiler/src/unused/expression/relational/eq.rs diff --git a/compiler/src/expression/relational/ge.rs b/compiler/src/unused/expression/relational/ge.rs similarity index 100% rename from compiler/src/expression/relational/ge.rs rename to compiler/src/unused/expression/relational/ge.rs diff --git a/compiler/src/expression/relational/gt.rs b/compiler/src/unused/expression/relational/gt.rs similarity index 100% rename from compiler/src/expression/relational/gt.rs rename to compiler/src/unused/expression/relational/gt.rs diff --git a/compiler/src/expression/relational/le.rs b/compiler/src/unused/expression/relational/le.rs similarity index 100% rename from compiler/src/expression/relational/le.rs rename to compiler/src/unused/expression/relational/le.rs diff --git a/compiler/src/expression/relational/lt.rs b/compiler/src/unused/expression/relational/lt.rs similarity index 100% rename from compiler/src/expression/relational/lt.rs rename to compiler/src/unused/expression/relational/lt.rs diff --git a/compiler/src/expression/relational/mod.rs b/compiler/src/unused/expression/relational/mod.rs similarity index 100% rename from compiler/src/expression/relational/mod.rs rename to compiler/src/unused/expression/relational/mod.rs diff --git a/compiler/src/expression/tuple/access.rs b/compiler/src/unused/expression/tuple/access.rs similarity index 100% rename from compiler/src/expression/tuple/access.rs rename to compiler/src/unused/expression/tuple/access.rs diff --git a/compiler/src/expression/tuple/mod.rs b/compiler/src/unused/expression/tuple/mod.rs similarity index 100% rename from compiler/src/expression/tuple/mod.rs rename to compiler/src/unused/expression/tuple/mod.rs diff --git a/compiler/src/expression/tuple/tuple.rs b/compiler/src/unused/expression/tuple/tuple.rs similarity index 100% rename from compiler/src/expression/tuple/tuple.rs rename to compiler/src/unused/expression/tuple/tuple.rs diff --git a/compiler/src/expression/variable_ref/mod.rs b/compiler/src/unused/expression/variable_ref/mod.rs similarity index 100% rename from compiler/src/expression/variable_ref/mod.rs rename to compiler/src/unused/expression/variable_ref/mod.rs diff --git a/compiler/src/expression/variable_ref/variable_ref.rs b/compiler/src/unused/expression/variable_ref/variable_ref.rs similarity index 100% rename from compiler/src/expression/variable_ref/variable_ref.rs rename to compiler/src/unused/expression/variable_ref/variable_ref.rs diff --git a/compiler/src/function/function.rs b/compiler/src/unused/function/function.rs similarity index 100% rename from compiler/src/function/function.rs rename to compiler/src/unused/function/function.rs diff --git a/compiler/src/function/input/array.rs b/compiler/src/unused/function/input/array.rs similarity index 100% rename from compiler/src/function/input/array.rs rename to compiler/src/unused/function/input/array.rs diff --git a/compiler/src/function/input/input_keyword.rs b/compiler/src/unused/function/input/input_keyword.rs similarity index 100% rename from compiler/src/function/input/input_keyword.rs rename to compiler/src/unused/function/input/input_keyword.rs diff --git a/compiler/src/function/input/input_section.rs b/compiler/src/unused/function/input/input_section.rs similarity index 100% rename from compiler/src/function/input/input_section.rs rename to compiler/src/unused/function/input/input_section.rs diff --git a/compiler/src/function/input/main_function_input.rs b/compiler/src/unused/function/input/main_function_input.rs similarity index 100% rename from compiler/src/function/input/main_function_input.rs rename to compiler/src/unused/function/input/main_function_input.rs diff --git a/compiler/src/function/input/mod.rs b/compiler/src/unused/function/input/mod.rs similarity index 100% rename from compiler/src/function/input/mod.rs rename to compiler/src/unused/function/input/mod.rs diff --git a/compiler/src/function/input/tuple.rs b/compiler/src/unused/function/input/tuple.rs similarity index 100% rename from compiler/src/function/input/tuple.rs rename to compiler/src/unused/function/input/tuple.rs diff --git a/compiler/src/function/main_function.rs b/compiler/src/unused/function/main_function.rs similarity index 100% rename from compiler/src/function/main_function.rs rename to compiler/src/unused/function/main_function.rs diff --git a/compiler/src/function/mod.rs b/compiler/src/unused/function/mod.rs similarity index 100% rename from compiler/src/function/mod.rs rename to compiler/src/unused/function/mod.rs diff --git a/compiler/src/function/mut_target.rs b/compiler/src/unused/function/mut_target.rs similarity index 100% rename from compiler/src/function/mut_target.rs rename to compiler/src/unused/function/mut_target.rs diff --git a/compiler/src/function/result/mod.rs b/compiler/src/unused/function/result/mod.rs similarity index 100% rename from compiler/src/function/result/mod.rs rename to compiler/src/unused/function/result/mod.rs diff --git a/compiler/src/function/result/result.rs b/compiler/src/unused/function/result/result.rs similarity index 100% rename from compiler/src/function/result/result.rs rename to compiler/src/unused/function/result/result.rs diff --git a/compiler/src/unused/lib.rs b/compiler/src/unused/lib.rs new file mode 100644 index 0000000000..d020bfb780 --- /dev/null +++ b/compiler/src/unused/lib.rs @@ -0,0 +1,66 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +//! The compiler for Leo programs. +//! +//! The [`Compiler`] type compiles Leo programs into R1CS circuits. + +#![allow(clippy::module_inception)] +#![allow(clippy::upper_case_acronyms)] +#![doc = include_str!("../README.md")] + +pub mod compiler; + +pub mod console; +pub use console::*; + +pub mod constraints; +pub use constraints::*; + +pub mod definition; + +pub mod expression; +pub use expression::*; + +pub mod function; +pub use function::*; + +pub mod output; +pub use output::*; + +pub mod program; +pub use program::*; + +pub mod statement; +pub use statement::*; + +pub mod prelude; +pub use prelude::*; + +pub mod value; +pub use value::*; + +pub mod phase; +pub use phase::*; + +pub mod phases; +pub use phases::*; + +pub mod option; +pub use option::*; + +#[cfg(test)] +mod test; diff --git a/compiler/src/option.rs b/compiler/src/unused/option.rs similarity index 100% rename from compiler/src/option.rs rename to compiler/src/unused/option.rs diff --git a/compiler/src/output/mod.rs b/compiler/src/unused/output/mod.rs similarity index 100% rename from compiler/src/output/mod.rs rename to compiler/src/unused/output/mod.rs diff --git a/compiler/src/output/output_bytes.rs b/compiler/src/unused/output/output_bytes.rs similarity index 100% rename from compiler/src/output/output_bytes.rs rename to compiler/src/unused/output/output_bytes.rs diff --git a/compiler/src/output/output_file.rs b/compiler/src/unused/output/output_file.rs similarity index 100% rename from compiler/src/output/output_file.rs rename to compiler/src/unused/output/output_file.rs diff --git a/compiler/src/phase.rs b/compiler/src/unused/phase.rs similarity index 100% rename from compiler/src/phase.rs rename to compiler/src/unused/phase.rs diff --git a/compiler/src/phases/mod.rs b/compiler/src/unused/phases/mod.rs similarity index 100% rename from compiler/src/phases/mod.rs rename to compiler/src/unused/phases/mod.rs diff --git a/compiler/src/phases/phase.rs b/compiler/src/unused/phases/phase.rs similarity index 100% rename from compiler/src/phases/phase.rs rename to compiler/src/unused/phases/phase.rs diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/unused/phases/reducing_director.rs similarity index 100% rename from compiler/src/phases/reducing_director.rs rename to compiler/src/unused/phases/reducing_director.rs diff --git a/compiler/src/prelude/mod.rs b/compiler/src/unused/prelude/mod.rs similarity index 100% rename from compiler/src/prelude/mod.rs rename to compiler/src/unused/prelude/mod.rs diff --git a/compiler/src/program/mod.rs b/compiler/src/unused/program/mod.rs similarity index 100% rename from compiler/src/program/mod.rs rename to compiler/src/unused/program/mod.rs diff --git a/compiler/src/program/program.rs b/compiler/src/unused/program/program.rs similarity index 100% rename from compiler/src/program/program.rs rename to compiler/src/unused/program/program.rs diff --git a/compiler/src/statement/assign/assign.rs b/compiler/src/unused/statement/assign/assign.rs similarity index 100% rename from compiler/src/statement/assign/assign.rs rename to compiler/src/unused/statement/assign/assign.rs diff --git a/compiler/src/statement/assign/assignee/array_index.rs b/compiler/src/unused/statement/assign/assignee/array_index.rs similarity index 100% rename from compiler/src/statement/assign/assignee/array_index.rs rename to compiler/src/unused/statement/assign/assignee/array_index.rs diff --git a/compiler/src/statement/assign/assignee/array_range_index.rs b/compiler/src/unused/statement/assign/assignee/array_range_index.rs similarity index 100% rename from compiler/src/statement/assign/assignee/array_range_index.rs rename to compiler/src/unused/statement/assign/assignee/array_range_index.rs diff --git a/compiler/src/statement/assign/assignee/member.rs b/compiler/src/unused/statement/assign/assignee/member.rs similarity index 100% rename from compiler/src/statement/assign/assignee/member.rs rename to compiler/src/unused/statement/assign/assignee/member.rs diff --git a/compiler/src/statement/assign/assignee/mod.rs b/compiler/src/unused/statement/assign/assignee/mod.rs similarity index 100% rename from compiler/src/statement/assign/assignee/mod.rs rename to compiler/src/unused/statement/assign/assignee/mod.rs diff --git a/compiler/src/statement/assign/assignee/tuple.rs b/compiler/src/unused/statement/assign/assignee/tuple.rs similarity index 100% rename from compiler/src/statement/assign/assignee/tuple.rs rename to compiler/src/unused/statement/assign/assignee/tuple.rs diff --git a/compiler/src/statement/assign/mod.rs b/compiler/src/unused/statement/assign/mod.rs similarity index 100% rename from compiler/src/statement/assign/mod.rs rename to compiler/src/unused/statement/assign/mod.rs diff --git a/compiler/src/statement/block/block.rs b/compiler/src/unused/statement/block/block.rs similarity index 100% rename from compiler/src/statement/block/block.rs rename to compiler/src/unused/statement/block/block.rs diff --git a/compiler/src/statement/block/mod.rs b/compiler/src/unused/statement/block/mod.rs similarity index 100% rename from compiler/src/statement/block/mod.rs rename to compiler/src/unused/statement/block/mod.rs diff --git a/compiler/src/statement/conditional/conditional.rs b/compiler/src/unused/statement/conditional/conditional.rs similarity index 100% rename from compiler/src/statement/conditional/conditional.rs rename to compiler/src/unused/statement/conditional/conditional.rs diff --git a/compiler/src/statement/conditional/mod.rs b/compiler/src/unused/statement/conditional/mod.rs similarity index 100% rename from compiler/src/statement/conditional/mod.rs rename to compiler/src/unused/statement/conditional/mod.rs diff --git a/compiler/src/statement/definition/definition.rs b/compiler/src/unused/statement/definition/definition.rs similarity index 100% rename from compiler/src/statement/definition/definition.rs rename to compiler/src/unused/statement/definition/definition.rs diff --git a/compiler/src/statement/definition/mod.rs b/compiler/src/unused/statement/definition/mod.rs similarity index 100% rename from compiler/src/statement/definition/mod.rs rename to compiler/src/unused/statement/definition/mod.rs diff --git a/compiler/src/statement/iteration/iteration.rs b/compiler/src/unused/statement/iteration/iteration.rs similarity index 100% rename from compiler/src/statement/iteration/iteration.rs rename to compiler/src/unused/statement/iteration/iteration.rs diff --git a/compiler/src/statement/iteration/mod.rs b/compiler/src/unused/statement/iteration/mod.rs similarity index 100% rename from compiler/src/statement/iteration/mod.rs rename to compiler/src/unused/statement/iteration/mod.rs diff --git a/compiler/src/statement/mod.rs b/compiler/src/unused/statement/mod.rs similarity index 100% rename from compiler/src/statement/mod.rs rename to compiler/src/unused/statement/mod.rs diff --git a/compiler/src/statement/return_/mod.rs b/compiler/src/unused/statement/return_/mod.rs similarity index 100% rename from compiler/src/statement/return_/mod.rs rename to compiler/src/unused/statement/return_/mod.rs diff --git a/compiler/src/statement/return_/return_.rs b/compiler/src/unused/statement/return_/return_.rs similarity index 100% rename from compiler/src/statement/return_/return_.rs rename to compiler/src/unused/statement/return_/return_.rs diff --git a/compiler/src/statement/statement.rs b/compiler/src/unused/statement/statement.rs similarity index 100% rename from compiler/src/statement/statement.rs rename to compiler/src/unused/statement/statement.rs diff --git a/compiler/src/test.rs b/compiler/src/unused/test.rs similarity index 100% rename from compiler/src/test.rs rename to compiler/src/unused/test.rs diff --git a/compiler/src/value/address/address.rs b/compiler/src/unused/value/address/address.rs similarity index 100% rename from compiler/src/value/address/address.rs rename to compiler/src/unused/value/address/address.rs diff --git a/compiler/src/value/address/mod.rs b/compiler/src/unused/value/address/mod.rs similarity index 100% rename from compiler/src/value/address/mod.rs rename to compiler/src/unused/value/address/mod.rs diff --git a/compiler/src/value/boolean/input.rs b/compiler/src/unused/value/boolean/input.rs similarity index 100% rename from compiler/src/value/boolean/input.rs rename to compiler/src/unused/value/boolean/input.rs diff --git a/compiler/src/value/boolean/mod.rs b/compiler/src/unused/value/boolean/mod.rs similarity index 100% rename from compiler/src/value/boolean/mod.rs rename to compiler/src/unused/value/boolean/mod.rs diff --git a/compiler/src/value/char/char.rs b/compiler/src/unused/value/char/char.rs similarity index 100% rename from compiler/src/value/char/char.rs rename to compiler/src/unused/value/char/char.rs diff --git a/compiler/src/value/char/mod.rs b/compiler/src/unused/value/char/mod.rs similarity index 100% rename from compiler/src/value/char/mod.rs rename to compiler/src/unused/value/char/mod.rs diff --git a/compiler/src/value/field/field_type.rs b/compiler/src/unused/value/field/field_type.rs similarity index 100% rename from compiler/src/value/field/field_type.rs rename to compiler/src/unused/value/field/field_type.rs diff --git a/compiler/src/value/field/input.rs b/compiler/src/unused/value/field/input.rs similarity index 100% rename from compiler/src/value/field/input.rs rename to compiler/src/unused/value/field/input.rs diff --git a/compiler/src/value/field/mod.rs b/compiler/src/unused/value/field/mod.rs similarity index 100% rename from compiler/src/value/field/mod.rs rename to compiler/src/unused/value/field/mod.rs diff --git a/compiler/src/value/group/group_type.rs b/compiler/src/unused/value/group/group_type.rs similarity index 100% rename from compiler/src/value/group/group_type.rs rename to compiler/src/unused/value/group/group_type.rs diff --git a/compiler/src/value/group/input.rs b/compiler/src/unused/value/group/input.rs similarity index 100% rename from compiler/src/value/group/input.rs rename to compiler/src/unused/value/group/input.rs diff --git a/compiler/src/value/group/mod.rs b/compiler/src/unused/value/group/mod.rs similarity index 100% rename from compiler/src/value/group/mod.rs rename to compiler/src/unused/value/group/mod.rs diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/unused/value/group/targets/edwards_bls12.rs similarity index 100% rename from compiler/src/value/group/targets/edwards_bls12.rs rename to compiler/src/unused/value/group/targets/edwards_bls12.rs diff --git a/compiler/src/value/group/targets/mod.rs b/compiler/src/unused/value/group/targets/mod.rs similarity index 100% rename from compiler/src/value/group/targets/mod.rs rename to compiler/src/unused/value/group/targets/mod.rs diff --git a/compiler/src/value/integer/integer.rs b/compiler/src/unused/value/integer/integer.rs similarity index 100% rename from compiler/src/value/integer/integer.rs rename to compiler/src/unused/value/integer/integer.rs diff --git a/compiler/src/value/integer/macros.rs b/compiler/src/unused/value/integer/macros.rs similarity index 100% rename from compiler/src/value/integer/macros.rs rename to compiler/src/unused/value/integer/macros.rs diff --git a/compiler/src/value/integer/mod.rs b/compiler/src/unused/value/integer/mod.rs similarity index 100% rename from compiler/src/value/integer/mod.rs rename to compiler/src/unused/value/integer/mod.rs diff --git a/compiler/src/value/mod.rs b/compiler/src/unused/value/mod.rs similarity index 100% rename from compiler/src/value/mod.rs rename to compiler/src/unused/value/mod.rs diff --git a/compiler/src/value/value.rs b/compiler/src/unused/value/value.rs similarity index 100% rename from compiler/src/value/value.rs rename to compiler/src/unused/value/value.rs diff --git a/deprecated/state/Cargo.toml b/unused/state/Cargo.toml similarity index 100% rename from deprecated/state/Cargo.toml rename to unused/state/Cargo.toml diff --git a/deprecated/state/LICENSE.md b/unused/state/LICENSE.md similarity index 100% rename from deprecated/state/LICENSE.md rename to unused/state/LICENSE.md diff --git a/deprecated/state/README.md b/unused/state/README.md similarity index 100% rename from deprecated/state/README.md rename to unused/state/README.md diff --git a/deprecated/state/src/lib.rs b/unused/state/src/lib.rs similarity index 100% rename from deprecated/state/src/lib.rs rename to unused/state/src/lib.rs diff --git a/deprecated/state/src/local_data_commitment/local_data_commitment.rs b/unused/state/src/local_data_commitment/local_data_commitment.rs similarity index 100% rename from deprecated/state/src/local_data_commitment/local_data_commitment.rs rename to unused/state/src/local_data_commitment/local_data_commitment.rs diff --git a/deprecated/state/src/local_data_commitment/mod.rs b/unused/state/src/local_data_commitment/mod.rs similarity index 100% rename from deprecated/state/src/local_data_commitment/mod.rs rename to unused/state/src/local_data_commitment/mod.rs diff --git a/deprecated/state/src/local_data_commitment/state_leaf_values.rs b/unused/state/src/local_data_commitment/state_leaf_values.rs similarity index 100% rename from deprecated/state/src/local_data_commitment/state_leaf_values.rs rename to unused/state/src/local_data_commitment/state_leaf_values.rs diff --git a/deprecated/state/src/local_data_commitment/state_values.rs b/unused/state/src/local_data_commitment/state_values.rs similarity index 100% rename from deprecated/state/src/local_data_commitment/state_values.rs rename to unused/state/src/local_data_commitment/state_values.rs diff --git a/deprecated/state/src/record_commitment/dpc_record_values.rs b/unused/state/src/record_commitment/dpc_record_values.rs similarity index 100% rename from deprecated/state/src/record_commitment/dpc_record_values.rs rename to unused/state/src/record_commitment/dpc_record_values.rs diff --git a/deprecated/state/src/record_commitment/mod.rs b/unused/state/src/record_commitment/mod.rs similarity index 100% rename from deprecated/state/src/record_commitment/mod.rs rename to unused/state/src/record_commitment/mod.rs diff --git a/deprecated/state/src/record_commitment/record_commitment.rs b/unused/state/src/record_commitment/record_commitment.rs similarity index 100% rename from deprecated/state/src/record_commitment/record_commitment.rs rename to unused/state/src/record_commitment/record_commitment.rs diff --git a/deprecated/state/src/utilities/input_value.rs b/unused/state/src/utilities/input_value.rs similarity index 100% rename from deprecated/state/src/utilities/input_value.rs rename to unused/state/src/utilities/input_value.rs diff --git a/deprecated/state/src/utilities/mod.rs b/unused/state/src/utilities/mod.rs similarity index 100% rename from deprecated/state/src/utilities/mod.rs rename to unused/state/src/utilities/mod.rs diff --git a/deprecated/state/tests/inputs/test_record.state b/unused/state/tests/inputs/test_record.state similarity index 100% rename from deprecated/state/tests/inputs/test_record.state rename to unused/state/tests/inputs/test_record.state diff --git a/deprecated/state/tests/inputs/test_state.state b/unused/state/tests/inputs/test_state.state similarity index 100% rename from deprecated/state/tests/inputs/test_state.state rename to unused/state/tests/inputs/test_state.state diff --git a/deprecated/state/tests/mod.rs b/unused/state/tests/mod.rs similarity index 100% rename from deprecated/state/tests/mod.rs rename to unused/state/tests/mod.rs diff --git a/deprecated/state/tests/test_verify_local_data_commitment.rs b/unused/state/tests/test_verify_local_data_commitment.rs similarity index 100% rename from deprecated/state/tests/test_verify_local_data_commitment.rs rename to unused/state/tests/test_verify_local_data_commitment.rs diff --git a/deprecated/state/tests/test_verify_record_commitment.rs b/unused/state/tests/test_verify_record_commitment.rs similarity index 100% rename from deprecated/state/tests/test_verify_record_commitment.rs rename to unused/state/tests/test_verify_record_commitment.rs