add variable definition

This commit is contained in:
darkf 2013-10-23 20:54:26 -07:00
parent 0f127a00cd
commit 1bbc16f132
1 changed files with 8 additions and 0 deletions

View File

@ -146,6 +146,13 @@ ifExpr = do
bool = fmap BoolConst $ (symbol "true" >> return True) <|> (symbol "false" >> return False)
def = do
name <- identifier
whiteSpace
symbol "="
value <- exprparser
return $ Def name value
expr' = try block
<|> try funDef
<|> try call
@ -155,6 +162,7 @@ expr' = try block
<|> listSeq exprparser ListConst
<|> try ifExpr
<|> try bool
<|> try def
<|> fmap Var identifier
<|> fmap StrConst stringLiteral
<|> fmap IntConst integer