diff options
Diffstat (limited to 'lib/Language/Elna/Frontend/Parser.hs')
| -rw-r--r-- | lib/Language/Elna/Frontend/Parser.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Language/Elna/Frontend/Parser.hs b/lib/Language/Elna/Frontend/Parser.hs index a8e61d2..98638f7 100644 --- a/lib/Language/Elna/Frontend/Parser.hs +++ b/lib/Language/Elna/Frontend/Parser.hs @@ -16,7 +16,7 @@ import Language.Elna.Frontend.AST , Statement(..) , TypeExpression(..) , VariableDeclaration(..) - --, VariableAccess(..) + , VariableAccess(..) , Condition(..) , Expression(..) , Literal(..) @@ -64,7 +64,7 @@ termP :: Parser Expression termP = choice [ parensP expressionP , LiteralExpression <$> literalP - -- , VariableExpression <$> variableAccessP + , VariableExpression <$> variableAccessP ] operatorTable :: [[Operator Parser Expression]] @@ -91,13 +91,13 @@ operatorTable = expressionP :: Parser Expression expressionP = makeExprParser termP operatorTable -{- + variableAccessP :: Parser VariableAccess -variableAccessP = do +variableAccessP = VariableAccess <$> identifierP {- do identifier <- identifierP indices <- many $ bracketsP expressionP - pure $ foldr (flip ArrayAccess) (VariableAccess identifier) indices --} + pure $ foldr (flip ArrayAccess) (VariableAccess identifier) indices -} + conditionP :: Parser Condition conditionP = do lhs <- expressionP @@ -187,8 +187,8 @@ statementP = EmptyStatement <$ semicolonP <|> ifElseP <|> CompoundStatement <$> blockP (many statementP) - {-<|> try assignmentP - <|> try whileP -} + <|> try assignmentP + -- <|> try whileP <|> callP <?> "statement" where @@ -202,12 +202,12 @@ statementP <*> optional (symbol "else" *> statementP) {-whileP = WhileStatement <$> (symbol "while" *> parensP conditionP) - <*> statementP + <*> statementP -} assignmentP = AssignmentStatement <$> variableAccessP <* symbol ":=" <*> expressionP - <* semicolonP -} + <* semicolonP variableDeclarationP :: Parser VariableDeclaration variableDeclarationP = VariableDeclaration |
