From 528545f71dc20cd11095c53a8c2ba77d6cec8406 Mon Sep 17 00:00:00 2001 From: numzero Date: Sat, 19 Apr 2025 11:03:50 +0300 Subject: [PATCH] Add Function to AST --- src/ast.rs | 6 ++++++ src/run.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/src/ast.rs b/src/ast.rs index 940cc64..01517bb 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -31,6 +31,12 @@ pub enum Expression { callee: Ident, args: Vec, }, + Function { + name: Option, + args: Vec, + body: Vec, + ret: Option>, + }, } #[derive(Debug, Clone, Default)] diff --git a/src/run.rs b/src/run.rs index c70d51d..3914ea4 100644 --- a/src/run.rs +++ b/src/run.rs @@ -103,6 +103,7 @@ impl Eval for Expression { let args = args.iter().map(|arg| arg.eval(scope)).collect(); (function.inner)(scope, args) } + Expression::Function { .. } => todo!(), } } }