This repository has been archived on 2020-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
not-python-old.2020-08-27/src/compile/mod.rs

51 lines
835 B
Rust
Raw Normal View History

pub mod block;
pub mod error;
pub mod ir;
pub mod name;
pub mod visit;
use crate::compile::name::NameStack;
// * Desugar
// * Collect names as symbols
// * Create basic blocks
pub struct Ctx<'t> {
text: &'t str,
name_stack: NameStack,
}
impl<'t> Ctx<'t> {
pub fn new(text: &'t str) -> Self {
Ctx {
text,
name_stack: NameStack::new(),
}
}
pub fn text(&self) -> &'t str {
self.text
}
pub fn name_stack(&self) -> &NameStack {
&self.name_stack
}
pub fn name_stack_mut(&mut self) -> &mut NameStack {
&mut self.name_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
}
}
*/