43 lines
655 B
Rust
43 lines
655 B
Rust
|
|
pub mod sym;
|
||
|
|
|
||
|
|
use crate::{
|
||
|
|
syn::ast::Stmt,
|
||
|
|
compile::sym::SymStack,
|
||
|
|
};
|
||
|
|
|
||
|
|
pub trait Pass {
|
||
|
|
type Out;
|
||
|
|
fn pass(&self, ctx: &mut Ctx) -> Self::Out;
|
||
|
|
}
|
||
|
|
|
||
|
|
// * Desugar
|
||
|
|
// * Collect names as symbols
|
||
|
|
// * Create basic blocks
|
||
|
|
|
||
|
|
pub struct Ctx {
|
||
|
|
sym_stack: SymStack,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Ctx {
|
||
|
|
pub fn sym_stack(&self) -> &SymStack {
|
||
|
|
&self.sym_stack
|
||
|
|
}
|
||
|
|
|
||
|
|
pub fn sym_stack_mut(&mut self) -> &mut SymStack {
|
||
|
|
&mut self.sym_stack
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// no sugar in the syntax quite yet
|
||
|
|
/*
|
||
|
|
pub struct Desugar;
|
||
|
|
|
||
|
|
impl Pass<Vec<Stmt>> for Desugar {
|
||
|
|
type Out = Vec<Stmt>;
|
||
|
|
|
||
|
|
fn pass(&mut self, input: Vec<Stmt>) -> Vec<Stmt> {
|
||
|
|
input
|
||
|
|
}
|
||
|
|
}
|
||
|
|
*/
|