Update the object language parser to use 'number' and 'string'

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2023-12-21 14:05:03 -08:00
parent fd301806c6
commit 401883c1da

View File

@ -52,8 +52,8 @@ parseType = Parser.lazy <| \() -> Parser.oneOf
parseTypeBasic : Parser Type
parseTypeBasic = Parser.lazy <| \() -> Parser.oneOf
[ Parser.succeed TInt |. Parser.keyword "tint"
, Parser.succeed TStr |. Parser.keyword "tstr"
[ Parser.succeed TInt |. Parser.keyword "number"
, Parser.succeed TStr |. Parser.keyword "string"
, Parser.backtrackable <| Parser.map (\(a, b) -> TPair a b) <| parsePair parseType
, parseParenthed parseType
]
@ -125,8 +125,8 @@ parseExprBasic = Parser.lazy <| \() -> Parser.oneOf
typeToTerm : Type -> Syntax.Term Metavariable
typeToTerm t =
case t of
TInt -> Syntax.Call "tint" []
TStr -> Syntax.Call "tstr" []
TInt -> Syntax.Call "number" []
TStr -> Syntax.Call "string" []
TPair t1 t2 -> Syntax.Call "tpair" [ typeToTerm t1, typeToTerm t2 ]
TArr t1 t2 -> Syntax.Call "tarr" [ typeToTerm t1, typeToTerm t2 ]