Add initial draft of symtable module.

This commit is contained in:
Windel Bouwman 2019-07-16 22:04:38 +02:00
parent 69c4d0b240
commit de2e496e1f
2 changed files with 3 additions and 2 deletions

View file

@ -8,4 +8,4 @@ extern crate log;
pub mod compile;
pub mod error;
mod symboltable;
pub mod symboltable;

View file

@ -36,7 +36,7 @@ pub fn statements_to_symbol_table(
Ok(symbol_table)
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum SymbolRole {
Global,
Nonlocal,
@ -45,6 +45,7 @@ pub enum SymbolRole {
}
/// Captures all symbols in the current scope, and has a list of subscopes in this scope.
#[derive(Clone)]
pub struct SymbolScope {
/// A set of symbols present on this scope level.
pub symbols: HashMap<String, SymbolRole>,