🖨️ Half a printing function part 2 (does not work)
This commit is contained in:
@ -101,26 +101,33 @@ pLExp =
|
|||||||
<$> (lKeyword "if" *> pExp)
|
<$> (lKeyword "if" *> pExp)
|
||||||
<*> (lKeyword "then" *> pExp)
|
<*> (lKeyword "then" *> pExp)
|
||||||
<*> (lKeyword "else" *> pExp),
|
<*> (lKeyword "else" *> pExp),
|
||||||
Print
|
|
||||||
<$> (lKeyword "print" *> pStringLit)
|
|
||||||
<*> pExp,
|
|
||||||
pFExp
|
pFExp
|
||||||
]
|
]
|
||||||
|
|
||||||
pPExp :: Parser Exp
|
pExp3 :: Parser Exp
|
||||||
pPExp = pLExp >>= chain
|
pExp3 =
|
||||||
|
choice
|
||||||
|
[
|
||||||
|
Print
|
||||||
|
<$> (lKeyword "print" *> pStringLit)
|
||||||
|
<*> pExp,
|
||||||
|
pLExp
|
||||||
|
]
|
||||||
|
|
||||||
|
pExp2 :: Parser Exp
|
||||||
|
pExp2 = pExp3 >>= chain
|
||||||
where
|
where
|
||||||
chain x =
|
chain x =
|
||||||
choice
|
choice
|
||||||
[ do
|
[ do
|
||||||
lString "**"
|
lString "**"
|
||||||
y <- pPExp
|
y <- pExp2
|
||||||
chain $ Pow x y,
|
chain $ Pow x y,
|
||||||
pure x
|
pure x
|
||||||
]
|
]
|
||||||
|
|
||||||
pExp1 :: Parser Exp
|
pExp1 :: Parser Exp
|
||||||
pExp1 = pPExp >>= chain
|
pExp1 = pExp2 >>= chain
|
||||||
where
|
where
|
||||||
chain x =
|
chain x =
|
||||||
choice
|
choice
|
||||||
|
Reference in New Issue
Block a user