From 249ab68e4744aed0a93ce9ff842c9f6fe0e13201 Mon Sep 17 00:00:00 2001
From: David Li
Date: Sun, 5 Nov 2017 21:16:57 -0500
Subject: Parse function declarations
---
src/taiga.lalrpop | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'src/taiga.lalrpop')
diff --git a/src/taiga.lalrpop b/src/taiga.lalrpop
index aa5e50e..0144aad 100644
--- a/src/taiga.lalrpop
+++ b/src/taiga.lalrpop
@@ -31,6 +31,10 @@ Declaration: Box> = {
Box::new(WithLocation::new(ast::Declaration::new_var(name, None, exp), l, r)),
"type" "=" =>
Box::new(WithLocation::new(ast::Declaration::new_ty(name, ty), l, r)),
+ "function" "(" ")" "=" =>
+ Box::new(WithLocation::new(ast::Declaration::new_fun(name, params, None, body), l, r)),
+ "function" "(" ")" ":" "=" =>
+ Box::new(WithLocation::new(ast::Declaration::new_fun(name, params, Some(ty), body), l, r)),
};
DeclarationsList: Vec> = {
--
cgit v1.2.3