walpurgis/src/ast_builder.rs

41 lines
702 B
Rust
Raw Normal View History

2023-11-16 16:27:03 -07:00
use crate::params::Params;
use crate::ast::{
Quantifier,
BaseType,
GlobalBlock,
Block,
Literal,
Declaration,
Variable,
BinaryOperator,
};
pub struct AstBuilder {
params: Params,
ast: GlobalBlock,
}
impl AstBuilder {
pub fn from(params: Params) -> Self {
Self {
params,
ast: GlobalBlock::default(),
}
}
pub fn generate(&self) {
}
}
impl ToString for AstBuilder {
fn to_string(&self) -> String {
let mut s = format!("// Generated by {} v{}\n",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
);
s.push_str(&self.ast.to_string());
s
}
}