aboutsummaryrefslogtreecommitdiff
path: root/src/parser/Assignment.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/Assignment.hs')
-rw-r--r--src/parser/Assignment.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/parser/Assignment.hs b/src/parser/Assignment.hs
new file mode 100644
index 0000000..bb782f5
--- /dev/null
+++ b/src/parser/Assignment.hs
@@ -0,0 +1,15 @@
+module Parser.Assignment where
+
+import Control.Applicative
+import Parser.Core
+import qualified Parser.Expr as E
+import Assignment
+
+variableP :: Parser Assignment
+variableP = Variable <$> alphaStringP <* char '=' <*> E.exprP
+
+functionP :: Parser Assignment
+functionP = Function <$> alphaStringP <*> parenthesize alphaStringP <* char '=' <*> E.exprP
+
+assignmentP :: Parser Assignment
+assignmentP = variableP <|> functionP