Move type check crate into analysis.

This commit is contained in:
chriseth
2024-01-22 11:29:51 +01:00
parent deb842a412
commit 00dc038259
5 changed files with 7 additions and 19 deletions

View File

@@ -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" }

View File

@@ -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<T: FieldElement>(
file: ASMProgram<T>,
monitor: &mut DiffMonitor,
) -> Result<AnalysisASMFile<T>, Vec<String>> {
// 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<T: FieldElement>(source: &str) -> Result<AnalysisASMFile<T>, Vec<String>> {
type_check::check(load_dependencies_and_resolve_str(source))
analysis::machine_check::check(load_dependencies_and_resolve_str(source))
}
}

View File

@@ -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<T: FieldElement>(file: ASMProgram<T>) -> Result<AnalysisASMFile<T>, Vec<String>> {
let ctx = AbsoluteSymbolPath::default();
let machines = TypeChecker::default().check_module(file.main, &ctx)?;

View File

@@ -12,4 +12,4 @@ pretty_assertions = "1.4.0"
parser = { path = "../parser" }
[dev-dependencies]
type_check = { path = "../type_check" }
analysis = { path = "../analysis" }

View File

@@ -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" }