AST.hs 600 B

12345678910111213141516171819202122232425262728293031323334353637
  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 String [(Identifier, Type)]
  11. | PrimType PrimType
  12. deriving (Eq, Show)
  13. data PrimType
  14. = Newtype String PrimType
  15. | EnumType String Bits [(Identifier, Integer)]
  16. | AtomType Atom
  17. deriving (Eq, Show)
  18. data Atom
  19. = AtomInt Bits
  20. | AtomWord Bits
  21. | AtomFloat
  22. | AtomDouble
  23. deriving (Eq, Show)
  24. data Bits
  25. = Bits8
  26. | Bits16
  27. | Bits32
  28. | Bits64
  29. deriving (Eq, Show)