🎃 Function application

This commit is contained in:
2024-09-26 15:57:23 +02:00
parent ff778af26f
commit 007b33f87d
3 changed files with 19 additions and 1 deletions

View File

@@ -75,6 +75,17 @@ pAtom =
lString "(" *> pExp <* lString ")"
]
pFExp :: Parser Exp
pFExp = pAtom >>= chain
where
chain x =
choice
[ do
y <- pAtom
chain $ Apply x y,
pure x
]
pLExp :: Parser Exp
pLExp =
choice
@@ -82,7 +93,7 @@ pLExp =
<$> (lKeyword "if" *> pExp)
<*> (lKeyword "then" *> pExp)
<*> (lKeyword "else" *> pExp),
pAtom
pFExp
]
pExp1 :: Parser Exp