schala/schala-lang/src/ast_reducing.rs

39 lines
499 B
Rust
Raw Normal View History

2018-05-09 02:27:57 -07:00
use std::rc::Rc;
2018-05-09 02:02:17 -07:00
2018-05-09 02:27:57 -07:00
use parsing::AST;
pub struct ReducedAST(pub Vec<Stmt>);
pub enum Stmt {
Binding {
name: Rc<String>,
expr: Expr,
},
Expr(Expr),
}
pub enum Expr {
Literal(Lit),
Func(Func),
Call {
f: Func,
args: Vec<Expr>,
},
}
pub enum Lit {
Int(u64),
Bool(bool),
StringLit(Rc<String>),
}
pub struct Func {
params: Vec<Rc<String>>,
body: Vec<Stmt>,
}
pub fn perform_ast_reduction(input: &AST) -> Result<ReducedAST, String> {
Ok(ReducedAST(vec![]))
}