Skip to content

Commit

Permalink
Merge pull request #13 from sandrolovnicki/dev
Browse files Browse the repository at this point in the history
dev [v2.1.1]
  • Loading branch information
Sandro Lovnički committed Sep 4, 2019
2 parents 4453cf6 + 44a2b1f commit c55b213
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import System.Environment
import System.Directory (doesFileExist)


version = "2.1.0"
version = "2.1.1"
heading = "\x1b[1;36m\
\ _\n\
\ | |\n\
Expand Down
2 changes: 1 addition & 1 deletion pLam.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pLam
version: 2.1.0
version: 2.1.1
-- synopsis:
-- description:
homepage: https://github.com/sandrolovnicki/pLam#readme
Expand Down
12 changes: 8 additions & 4 deletions src/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ languageDef =
, "\\"
, "["
, "]"
, ","
]
}

Expand All @@ -37,6 +36,7 @@ identifier = Token.identifier lexer
reserved = Token.reserved lexer
reservedOp = Token.reservedOp lexer
parens = Token.parens lexer
comma = Token.comma lexer
-------------------------------------------------------------------------------------

type Parser = Parsec String ()
Expand Down Expand Up @@ -86,13 +86,14 @@ createList (x:xs) = Abstraction (LambdaVar 'f' 0) (Abstraction (LambdaVar 'l' 0)
parseList :: Parser Expression
parseList = do
reservedOp "["
exprs <- parseExpression `sepBy` (char ',')
exprs <- parseExpression `sepBy` comma
reservedOp "]"
return $ createList exprs

parseNumeral :: Parser Expression
parseNumeral = do
strNum <- many1 digit
spaces
let intNum = read strNum :: Int
maybeB <- optionMaybe (char 'b')
case maybeB == (Just 'b') of
Expand Down Expand Up @@ -131,8 +132,11 @@ parseSingleton = parseList
<|> parens parseApplication

parseExpression :: Parser Expression
parseExpression = parseApplication
<|> parseSingleton
parseExpression = do
spaces
expr <- parseApplication <|> parseSingleton
spaces
return expr
-------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------
Expand Down

0 comments on commit c55b213

Please sign in to comment.