diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-08-30 21:02:24 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-08-30 21:02:24 +0100 |
commit | aaf2ef628772e5789203544ac6226b467891d1d9 (patch) | |
tree | 5d3dedb1e6c6c12791f8dc5d47d6d29a3b3b0fd8 /src/Parser.hs | |
parent | 49940ac6b38204c4b1eb60e9dc1c553c331ac122 (diff) | |
download | micro-lang-hs-aaf2ef628772e5789203544ac6226b467891d1d9.tar.gz micro-lang-hs-aaf2ef628772e5789203544ac6226b467891d1d9.zip |
Boolean type, and true/false symbols
Diffstat (limited to 'src/Parser.hs')
-rw-r--r-- | src/Parser.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Parser.hs b/src/Parser.hs index 41f2ba3..ea698c8 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -27,6 +27,18 @@ number = do n <- integer return $ Num n pos +true :: Parser Expr +true = do + pos <- getPosition + reserved "true" + return $ Bool' True pos + +false :: Parser Expr +false = do + pos <- getPosition + reserved "false" + return $ Bool' False pos + variable :: Parser Expr variable = do pos <- getPosition @@ -107,6 +119,8 @@ call = do factor :: Parser Expr factor = number + <|> true + <|> false <|> try call <|> try lambda <|> try variable |