From 29f6828b0e5e090ea22821bcd2a0e4285be19d14 Mon Sep 17 00:00:00 2001
From: p9malino26 <pm3g19@soton.ac.uk>
Date: Sat, 10 Apr 2021 11:28:46 +0100
Subject: [PATCH] Created grammar for simple version of the language

---
 Lexer.x  |  4 ++++
 Parser.y | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 Lexer.x
 create mode 100644 Parser.y

diff --git a/Lexer.x b/Lexer.x
new file mode 100644
index 0000000..63e7418
--- /dev/null
+++ b/Lexer.x
@@ -0,0 +1,4 @@
+--tokens
+
+.in
+.out
\ No newline at end of file
diff --git a/Parser.y b/Parser.y
new file mode 100644
index 0000000..112432f
--- /dev/null
+++ b/Parser.y
@@ -0,0 +1,28 @@
+Prog : .in SetNames .out SetFuncCalls
+
+SetNames : SetName
+    | SetName, SetNames
+    
+VarNames : VarName
+    | VarName, VarNames
+
+SetSetFuncCalls : SetFuncCall    {[SetFuncCall]}
+    | SetFuncCall; SetFuncCalls   {SetFuncCall:SetFuncCalls}
+
+SetFuncCall : filter '['SetName']' (Func)
+
+Func : \'('VarNames')' -> Expr
+\(r) -> r[1] == "hello"
+
+Expr : Expr == Expr
+    | Expr'['Nat']'
+    | String
+    | VarName
+    | Record
+    | true
+    | false
+
+
+Record : '['Exprs']'
+Exprs : Expr
+    | Expr','Exprs
-- 
GitLab