mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
remove let statement
This commit is contained in:
parent
c061c6d038
commit
39b2f10bb5
|
@ -45,7 +45,6 @@ pub enum PExpr {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum PStmt {
|
pub enum PStmt {
|
||||||
Expr(Spanned<PExpr>),
|
Expr(Spanned<PExpr>),
|
||||||
Let(Vec<(String, Type, Spanned<PExpr>)>),
|
|
||||||
Func {
|
Func {
|
||||||
name: String,
|
name: String,
|
||||||
args: Vec<(String, Type)>,
|
args: Vec<(String, Type)>,
|
||||||
|
|
|
@ -7,7 +7,6 @@ use crate::asts::{
|
||||||
pub fn translate_stmt(stmt: PStmt) -> Stmt {
|
pub fn translate_stmt(stmt: PStmt) -> Stmt {
|
||||||
match stmt {
|
match stmt {
|
||||||
PStmt::Expr(e) => Stmt::Expr(translate_expr(e.0)),
|
PStmt::Expr(e) => Stmt::Expr(translate_expr(e.0)),
|
||||||
PStmt::Let(vars) => todo!(),
|
|
||||||
PStmt::Func { name, args, ret, body } => Stmt::Func {
|
PStmt::Func { name, args, ret, body } => Stmt::Func {
|
||||||
name,
|
name,
|
||||||
args: args.into_iter().map(|(name, _ty)| name).collect(),
|
args: args.into_iter().map(|(name, _ty)| name).collect(),
|
||||||
|
@ -20,7 +19,7 @@ pub fn translate_stmt(stmt: PStmt) -> Stmt {
|
||||||
pub fn exprs_to_lam(es: Vec<PExpr>) -> Expr {
|
pub fn exprs_to_lam(es: Vec<PExpr>) -> Expr {
|
||||||
let lam = Expr::Lambda {
|
let lam = Expr::Lambda {
|
||||||
args: vec![],
|
args: vec![],
|
||||||
body: es.into_iter().map(|e| translate_expr(e)).collect(),
|
body: es.into_iter().map(translate_expr).collect(),
|
||||||
};
|
};
|
||||||
Expr::Call(Box::new(lam), vec![])
|
Expr::Call(Box::new(lam), vec![])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue