reic 0.1.0

A compiler that just works
Documentation
use lazy_static::lazy_static;
use serde_derive::{Deserialize, Serialize};
use std::{collections::HashMap, sync::Mutex};

use crate::expr::{ScopeType, ReiType};

// ---------------
// SYMBOL TABLE
// ---------------

// easier to parse if cleanly separate code and data
// a class contains data D and methods M, without any other stuff
// a trait contains direct statements of type trait method or type aliases
// Type compound can contain vec of compound data

/// Either int, float, bool, char
// #[derive(Debug, Hash, Serialize)]
// pub struct Primitive(Vec<u8>);
// impl Primitive {
//     pub fn new() -> Self {
//         Self(vec![])
//     }

//     pub fn len(&self) -> usize {
//         self.0.len()
//     }
// }

// What about data? you cant define anything else but data?
// Maybe make it a 'packed' collection

pub type Identifier = String;

/// Encompasses a root scope, a bunch of internal scopes and leaf scopes. Has a bunch of symbols that are in scope
#[derive(Debug, Serialize)]
pub struct ScopeTable {
    scope_type: ScopeType,
    symbols: HashMap<Identifier, ReiType>,
    inner_scopes: Vec<ScopeTable>,
}

impl ScopeTable {
    pub fn new(
        scope_type: ScopeType,
        symbols: HashMap<Identifier, ReiType>,
        inner_scopes: Vec<ScopeTable>,
    ) -> Self {
        Self {
            scope_type,
            symbols,
            inner_scopes,
        }
    }
}