aboutsummaryrefslogtreecommitdiff
path: root/src/Parser.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-06 22:22:32 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-06 22:22:32 +0100
commitd08042be1e0ae158f124bb6848f5843a804a6544 (patch)
tree71ffa63234c13f3bf7d31fe3c0a3876839cae2e8 /src/Parser.hs
parentf8dfbfc1604aea626a6502b9f6d06ea1299a0cdb (diff)
downloadmicro-lang-hs-d08042be1e0ae158f124bb6848f5843a804a6544.tar.gz
micro-lang-hs-d08042be1e0ae158f124bb6848f5843a804a6544.zip
Assignation
Diffstat (limited to 'src/Parser.hs')
-rw-r--r--src/Parser.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index 5ee6de9..12f04d9 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -7,10 +7,18 @@ import Text.Parsec
import qualified Text.Parsec.Expr as E
import Text.Parsec.String (Parser)
-binary s f assoc = E.Infix (reservedOp s >> return (BinOp f)) assoc
+binary s f assoc =
+ E.Infix
+ ( reservedOp s
+ >> do
+ pos <- getPosition
+ return $ BinOp f pos
+ )
+ assoc
opTable =
- [ [ binary "*" Mul E.AssocLeft,
+ [ [binary "=" Assign E.AssocLeft],
+ [ binary "*" Mul E.AssocLeft,
binary "/" Div E.AssocLeft
],
[ binary "+" Plus E.AssocLeft,