aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Parser.hs
diff options
context:
space:
mode:
authorMarvin Borner2023-02-20 22:02:37 +0100
committerMarvin Borner2023-02-20 22:02:37 +0100
commit7a9768dae668d2e08cefebaf39911a9b3f2366cf (patch)
treea2b4836b8c7891d2e74aca8d628e1f08c1b1e246 /src/Parser.hs
parent8e3a7a0d5b0096a0e7bea934fa55ee910a7a3f0a (diff)
Removed typechecking
Well, it's unnecessary complexity :D I might add checking again in the future, but you'll need to typecheck in your head for now.
Diffstat (limited to 'src/Parser.hs')
-rw-r--r--src/Parser.hs40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index b65a59e..b2579a9 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -197,40 +197,39 @@ parseEvaluate = do
e <- parseExpression
pure $ ContextualInstruction (Evaluate e) inp
-parseFunctionType :: Parser Type
+parseFunctionType :: Parser ()
parseFunctionType =
- (FunctionType <$> sepBy1 parseTypeSingleton (sc *> char '→' <* sc))
+ sepBy1 parseTypeSingleton (sc *> char '→' <* sc)
+ >> return ()
<?> "function type"
-parseConstructorType :: Parser Type
+parseConstructorType :: Parser ()
parseConstructorType = do
- i <- typeIdentifier
+ _ <- typeIdentifier
sc
- is <- sepBy1 parseTypeSingleton sc
- (pure $ ConstructorType i is) <?> "constructor type"
+ _ <- sepBy1 parseTypeSingleton sc
+ return () <?> "constructor type"
-parseTypeIdentifier :: Parser Type
-parseTypeIdentifier = NormalType <$> typeIdentifier <?> "type identifier"
+parseTypeIdentifier :: Parser ()
+parseTypeIdentifier = typeIdentifier >> return () <?> "type identifier"
-parsePolymorphicTypeIdentifier :: Parser Type
+parsePolymorphicTypeIdentifier :: Parser ()
parsePolymorphicTypeIdentifier =
- PolymorphicType
- <$> polymorphicTypeIdentifier
- <?> "polymorphic type identifier"
+ polymorphicTypeIdentifier >> return () <?> "polymorphic type identifier"
-parseTypeSingleton :: Parser Type
+parseTypeSingleton :: Parser ()
parseTypeSingleton =
try (parens parseFunctionType)
<|> try (parens parseConstructorType)
<|> try parseTypeIdentifier
<|> try parsePolymorphicTypeIdentifier
-parseTypeExpression :: Parser Type
+parseTypeExpression :: Parser ()
parseTypeExpression = parseFunctionType <?> "type expression"
-parseDefineType :: Parser Type
+parseDefineType :: Parser ()
parseDefineType = do
- (try $ char '⧗' <* sc *> parseTypeExpression) <|> (return AnyType)
+ (try $ char '⧗' <* sc *> parseTypeExpression) <|> (return ())
parseDefine :: Int -> Parser Instruction
parseDefine lvl = do
@@ -238,10 +237,10 @@ parseDefine lvl = do
var <- defIdentifier
sc
e <- parseExpression
- t <- parseDefineType
+ _ <- parseDefineType
subs <-
(try $ newline *> (many (parseBlock (lvl + 1)))) <|> (try eof >> return [])
- pure $ ContextualInstruction (Define var e t subs) inp
+ pure $ ContextualInstruction (Define var e subs) inp
parseReplDefine :: Parser Instruction
parseReplDefine = do
@@ -250,7 +249,7 @@ parseReplDefine = do
_ <- sc *> char '=' <* sc
e <- parseExpression
t <- parseDefineType
- pure $ ContextualInstruction (Define var e t []) inp
+ pure $ ContextualInstruction (Define var e []) inp
parseComment :: Parser ()
parseComment = do
@@ -308,6 +307,7 @@ parseBlock lvl =
parseReplLine :: Parser Instruction
parseReplLine =
try parseReplDefine -- TODO: This is kinda hacky
- <|> ((Commands . (: [])) <$> (try parseImport))
<|> ((Commands . (: [])) <$> (try parseTest))
+ <|> ((Commands . (: [])) <$> (try parseInput))
+ <|> ((Commands . (: [])) <$> (try parseImport))
<|> try parseEvaluate