Simple semantic analysis structure

This commit is contained in:
2026-04-15 08:32:29 +02:00
parent 5de519f561
commit 6df7f672d0
4 changed files with 26 additions and 13 deletions
Generated
+5
View File
@@ -79,6 +79,7 @@ name = "mist"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"parser", "parser",
"semantic",
"serde", "serde",
"serde_json", "serde_json",
] ]
@@ -154,6 +155,10 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "semantic"
version = "0.1.0"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.228" version = "1.0.228"
+1
View File
@@ -7,3 +7,4 @@ edition = "2024"
serde = { version = "1.0.228", features = ["serde_derive"] } serde = { version = "1.0.228", features = ["serde_derive"] }
serde_json = "1.0.149" serde_json = "1.0.149"
parser = { path = "./parser" } parser = { path = "./parser" }
semantic = { path = "./semantic" }
+2 -13
View File
@@ -1,14 +1,3 @@
pub fn add(left: u64, right: u64) -> u64 { pub mod top_level;
left + right
}
#[cfg(test)] pub struct Scope {}
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
+18
View File
@@ -0,0 +1,18 @@
use std::collections::HashMap;
pub struct TypeSymbol {
export: bool,
name: String,
}
pub struct FunctionSymbol {
export: bool,
name: String,
params: HashMap<String, TypeSymbol>,
}
pub struct StructSymbol {
export: bool,
name: String,
fields: HashMap<String, TypeSymbol>,
}