Changed to explicit functions

(idk if work, still need to add printing)
This commit is contained in:
Macocian Adrian Radu
2022-04-07 03:25:14 +02:00
parent f18066e5da
commit de940ca92e
9 changed files with 233 additions and 176 deletions

View File

@@ -20,7 +20,7 @@ functionParser =
fDescription <- optional descriptionParser
fInput <- inputAttributesParser
fOutput <- outputAttributeParser
MakeFunction fName fDescription fInput fOutput <$> assignmentParser
MakeFunction (MakeFunctionSignature fName fDescription fInput fOutput) <$> assignmentParser
-- |Parses the output assignment statement from a function in Rosetta into an Expression
assignmentParser :: Parser Expression

View File

@@ -44,7 +44,7 @@ typeAttributeParser =
-- |Parses the cardinality of a type attribute in Rosetta into a Cardinality
cardinalityParser :: Parser Cardinality
cardinalityParser = try parseBounded <|> try parseSemiBounded <|> try parseUnbounded
cardinalityParser = try parseBounded <|> try parseSemiBounded
-- |Parser the condition of a type attribute in Rosetta into a Condition
conditionParser :: Parser Condition
@@ -74,13 +74,6 @@ parseSemiBounded =
low <- lexeme $ many digitChar
_ <- lexeme $ string "..*)"
return $ OneBound $ read low
-- |Parses an unbounded cardinality statement in Rosetta into a Cardinality
parseUnbounded :: Parser Cardinality
parseUnbounded =
do
_ <- lexeme $ string "(*..*)"
return NoBounds
-- |Parses the name of a type in Rosetta into a String
typeNameParser :: Parser String