AST.hs 755 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module Gidl.Types.AST where
  2. type Identifier = String
  3. type TypeName = String
  4. data TypeEnv
  5. = TypeEnv [(TypeName, Type)]
  6. deriving (Eq, Show)
  7. emptyTypeEnv :: TypeEnv
  8. emptyTypeEnv = TypeEnv []
  9. data Type
  10. = StructType Struct
  11. | NewtypeType Newtype
  12. | EnumType EnumT
  13. | AtomType Atom
  14. -- | MaybeType Type
  15. -- | EitherType Type Type
  16. deriving (Eq, Show)
  17. data Atom
  18. = AtomInt Bits
  19. | AtomWord Bits
  20. | AtomFloat
  21. | AtomDouble
  22. -- | AtomString Int
  23. deriving (Eq, Show)
  24. data Bits
  25. = Bits8
  26. | Bits16
  27. | Bits32
  28. | Bits64
  29. deriving (Eq, Show)
  30. data Struct
  31. = Struct [(Identifier, TypeName)]
  32. deriving (Eq, Show)
  33. data Newtype
  34. = Newtype TypeName
  35. deriving (Eq, Show)
  36. data EnumT
  37. = EnumT Bits [(Identifier, Integer)]
  38. deriving (Eq, Show)