Implement comparison operators

This commit is contained in:
2024-10-13 12:59:47 +02:00
parent 0850f0a8d6
commit 582040e5d3
19 changed files with 261 additions and 43 deletions

View File

@@ -105,12 +105,12 @@ conditionP = do
conditionCons lhs <$> expressionP
where
comparisonOperator =
--, symbol "<" >> pure LessCondition
--, symbol "<=" >> pure LessOrEqualCondition
--, symbol ">" >> pure GreaterCondition
--, symbol ">=" >> pure GreaterOrEqualCondition
[ symbol "=" >> pure EqualCondition
--, symbol "#" >> pure NonEqualCondition
[ symbol "<=" >> pure LessOrEqualCondition
, symbol "<" >> pure LessCondition
, symbol ">=" >> pure GreaterOrEqualCondition
, symbol ">" >> pure GreaterCondition
, symbol "=" >> pure EqualCondition
, symbol "#" >> pure NonEqualCondition
]
symbol :: Text -> Parser Text
@@ -183,8 +183,8 @@ statementP :: Parser Statement
statementP
= EmptyStatement <$ semicolonP
<|> ifElseP
{-<|> CompoundStatement <$> blockP (many statementP)
<|> try assignmentP
<|> CompoundStatement <$> blockP (many statementP)
{-<|> try assignmentP
<|> try whileP -}
<|> callP
<?> "statement"