parse types

This commit is contained in:
crumbtoo
2023-12-20 14:10:33 -07:00
parent 414312cf98
commit fe90c9afb0
2 changed files with 8 additions and 4 deletions

View File

@@ -95,7 +95,14 @@ ScDef :: { ScDef Name }
ScDef : Var ParList '=' Expr { ScDef $1 $2 $4 }
Type :: { Type }
Type : Var { TyInt }
Type : Type1 { $1 }
Type1 :: { Type }
Type1 : '(' Type ')' { $2 }
| Type1 '->' Type { $1 :-> $3 }
-- do we want to use Var instead, permitting symbolic type vars?
| varname { TyVar $1 }
| conname { TyCon $1 }
ParList :: { [Name] }
ParList : Var ParList { $1 : $2 }

View File

@@ -139,9 +139,6 @@ instance IsString (Expr b) where
instance IsString Type where
fromString = TyVar
instance Semigroup (Program b) where
(<>) = coerce $ (<>) @[ScDef b]
instance (Hashable b) => Semigroup (Program b) where
(<>) = undefined