Simple semantic analysis structure
This commit is contained in:
Generated
+5
@@ -79,6 +79,7 @@ name = "mist"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"parser",
|
||||
"semantic",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
@@ -154,6 +155,10 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semantic"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.228"
|
||||
|
||||
@@ -7,3 +7,4 @@ edition = "2024"
|
||||
serde = { version = "1.0.228", features = ["serde_derive"] }
|
||||
serde_json = "1.0.149"
|
||||
parser = { path = "./parser" }
|
||||
semantic = { path = "./semantic" }
|
||||
|
||||
+2
-13
@@ -1,14 +1,3 @@
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
pub mod top_level;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
pub struct Scope {}
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
Reference in New Issue
Block a user