From 06bac51db516583d81110f4bae49e7fe46313359 Mon Sep 17 00:00:00 2001 From: limuy Date: Sat, 13 Apr 2024 16:46:32 +0800 Subject: [PATCH] feat(readme):add badges --- README.md | 10 +++++++++- docs/usage.md | 4 ++-- src/compiler.rs | 1 + src/compiler/manager.rs | 28 ++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/compiler/manager.rs diff --git a/README.md b/README.md index 638d3ef3..e9ed1697 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ # Trc programming language -Trc is a easy-learn programming language.It can be fast,safe and effective. +Trc is a easy-learn programming language. It can be fast,safe and effective. + +|Platform|Status| +|:---|:---| +|Linux|![Linux Test](https://img.shields.io/github/actions/workflow/status/limuy2022/trc/rust_linux.yml)| +|Winodows|![Windows Test](https://img.shields.io/github/actions/workflow/status/limuy2022/trc/rust_windows.yml)| +|Macos|![Macos Test](https://img.shields.io/github/actions/workflow/status/limuy2022/trc/rust_macos.yml)| + +![Total Lines](https://tokei.rs/b1/github/limuy2022/trc) ## Goal diff --git a/docs/usage.md b/docs/usage.md index 41a0bcaf..1be8681a 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -39,10 +39,10 @@ The next is the string value. To make you to write strings more easily: There are also many easape char in the string: | escape char | meaning | -| :---------- | :-------------------------------- | --- | +| :---------- | :-------------------------------- | | \t | tab | | \n | new line | -| \\\\ | \| | | +| \\\\ | \| | | \' | ' | | \" | " | | \0 | the tick of the end of the string | diff --git a/src/compiler.rs b/src/compiler.rs index ffa9a238..acefe407 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1,6 +1,7 @@ pub mod ast; pub mod linker; pub mod llvm_convent; +pub mod manager; pub mod scope; pub mod token; diff --git a/src/compiler/manager.rs b/src/compiler/manager.rs new file mode 100644 index 00000000..59b4ffdf --- /dev/null +++ b/src/compiler/manager.rs @@ -0,0 +1,28 @@ +use std::collections::HashMap; + +use crate::compiler::ast::AstBuilder; + +/// ast的控制者,总管一个编译过程中的数据 + +/// ast manager +pub struct AstManager<'a> { + // 储存模块和对应的中间文件的关系 + modules: HashMap, + // 有的模块是本次已经编译过的,在缓存中可以直接找到 + cache: HashMap>, +} + +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() + } +}