Parse type declarations

This commit is contained in:
2024-10-17 00:37:42 +02:00
parent 582040e5d3
commit bf5ec1f3e2
4 changed files with 21 additions and 13 deletions

View File

@@ -52,14 +52,14 @@ literalP
where
charP = fromIntegral . fromEnum
<$> between (char '\'') (char '\'') Lexer.charLiteral
{-
typeDefinitionP :: Parser Declaration
typeDefinitionP = TypeDefinition
<$> (symbol "type" *> identifierP)
<*> (symbol "=" *> typeExpressionP)
<* semicolonP
<?> "type definition"
-}
termP :: Parser Expression
termP = choice
[ parensP expressionP
@@ -214,7 +214,7 @@ variableDeclarationP = VariableDeclaration
<?> "variable declaration"
declarationP :: Parser Declaration
declarationP = procedureDeclarationP -- <|> typeDefinitionP
declarationP = procedureDeclarationP <|> typeDefinitionP
programP :: Parser Program
programP = Program <$> many declarationP <* eof