-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
pub mod ast; | ||
pub mod linker; | ||
pub mod llvm_convent; | ||
pub mod manager; | ||
pub mod scope; | ||
pub mod token; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::collections::HashMap; | ||
|
||
use crate::compiler::ast::AstBuilder; | ||
|
||
/// ast的控制者,总管一个编译过程中的数据 | ||
/// ast manager | ||
pub struct AstManager<'a> { | ||
// 储存模块和对应的中间文件的关系 | ||
modules: HashMap<String, String>, | ||
// 有的模块是本次已经编译过的,在缓存中可以直接找到 | ||
cache: HashMap<String, AstBuilder<'a>>, | ||
} | ||
|
||
impl<'a> AstManager<'a> { | ||
pub fn new() -> Self { | ||
Self { | ||
modules: HashMap::new(), | ||
cache: HashMap::new(), | ||
} | ||
} | ||
} | ||
|
||
impl<'a> Default for AstManager<'a> { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} |