Difficult ownership questions

This commit is contained in:
2022-05-30 05:21:00 +02:00
parent 1e8aa45176
commit ec1734e113
15 changed files with 441 additions and 89 deletions

53
src/project/mod.rs Normal file
View File

@@ -0,0 +1,53 @@
use std::collections::HashMap;
mod resolve_names;
#[derive(Debug, Clone)]
pub struct Project {
pub modules: HashMap<Vec<String>, Module>,
}
#[derive(Debug, Clone)]
pub struct Export {
isSymbol: bool,
subpaths: HashMap<String, Export>
}
#[derive(Debug, Clone)]
pub struct Module {
pub substitutions: Vec<Substitution>,
pub exports: HashMap<String, Export>,
pub all_ops: Vec<String>
}
#[derive(Debug, Clone)]
pub struct Substitution {
pub source: Expr,
pub priority: f64,
pub target: Expr
}
#[derive(Debug, Clone)]
pub enum Literal {
Num(f64),
Int(u64),
Char(char),
Str(String),
}
#[derive(Debug, Clone)]
pub enum Token {
Literal(Literal),
Name(String),
Bound,
S(Vec<Expr>),
Lambda(Vec<Vec<usize>>, Option<Box<Expr>>, Vec<Expr>),
Auto(Option<Vec<Vec<usize>>>, Option<Box<Expr>>, Vec<Expr>)
}
#[derive(Debug, Clone)]
pub struct Expr {
pub token: Token,
pub typ: Box<Expr>
}