From 00dc0382594ff3fc7932a60014c3660948656d5b Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 22 Jan 2024 11:29:51 +0100 Subject: [PATCH] Move type check crate into analysis. --- analysis/Cargo.toml | 1 - analysis/src/lib.rs | 8 ++++---- .../src/lib.rs => analysis/src/machine_check.rs | 2 ++ asm_to_pil/Cargo.toml | 2 +- type_check/Cargo.toml | 13 ------------- 5 files changed, 7 insertions(+), 19 deletions(-) rename type_check/src/lib.rs => analysis/src/machine_check.rs (98%) delete mode 100644 type_check/Cargo.toml diff --git a/analysis/Cargo.toml b/analysis/Cargo.toml index fb27e69e0..419764b68 100644 --- a/analysis/Cargo.toml +++ b/analysis/Cargo.toml @@ -10,7 +10,6 @@ log = "0.4.18" number = { path = "../number" } parser = { path = "../parser" } asm_to_pil = { path = "../asm_to_pil" } -type_check = { path = "../type_check" } [dev-dependencies] parser = { path = "../parser" } diff --git a/analysis/src/lib.rs b/analysis/src/lib.rs index adb7a1c7a..cffd11279 100644 --- a/analysis/src/lib.rs +++ b/analysis/src/lib.rs @@ -1,6 +1,7 @@ #![deny(clippy::print_stdout)] mod block_enforcer; +mod machine_check; mod vm; use ast::{asm_analysis::AnalysisASMFile, parsed::asm::ASMProgram, DiffMonitor}; @@ -18,9 +19,8 @@ pub fn analyze( file: ASMProgram, monitor: &mut DiffMonitor, ) -> Result, Vec> { - // type check - log::debug!("Run type-check analysis step"); - let file = type_check::check(file)?; + log::debug!("Run machine check analysis step"); + let file = machine_check::check(file)?; monitor.push(&file); // run analysis on virtual machines, batching instructions @@ -69,6 +69,6 @@ mod test_util { /// A test utility to process a source file until after type checking pub fn typecheck_str(source: &str) -> Result, Vec> { - type_check::check(load_dependencies_and_resolve_str(source)) + analysis::machine_check::check(load_dependencies_and_resolve_str(source)) } } diff --git a/type_check/src/lib.rs b/analysis/src/machine_check.rs similarity index 98% rename from type_check/src/lib.rs rename to analysis/src/machine_check.rs index 178add55f..2941e02ea 100644 --- a/type_check/src/lib.rs +++ b/analysis/src/machine_check.rs @@ -21,6 +21,8 @@ use ast::{ }; use number::FieldElement; +/// Verifies certain properties of each machine and constructs the Machine objects. +/// Also transfers generic PIL definitions but does not verify anything about them. pub fn check(file: ASMProgram) -> Result, Vec> { let ctx = AbsoluteSymbolPath::default(); let machines = TypeChecker::default().check_module(file.main, &ctx)?; diff --git a/asm_to_pil/Cargo.toml b/asm_to_pil/Cargo.toml index c4f7ab21c..957055956 100644 --- a/asm_to_pil/Cargo.toml +++ b/asm_to_pil/Cargo.toml @@ -12,4 +12,4 @@ pretty_assertions = "1.4.0" parser = { path = "../parser" } [dev-dependencies] -type_check = { path = "../type_check" } +analysis = { path = "../analysis" } diff --git a/type_check/Cargo.toml b/type_check/Cargo.toml deleted file mode 100644 index 00d2e65e6..000000000 --- a/type_check/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "type_check" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -ast = { path = "../ast" } -number = { path = "../number" } - -[dev-dependencies] -importer = { path = "../importer" }