Base.hs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. module Gidl.Types.Base
  2. ( uint8_t
  3. , uint16_t
  4. , uint32_t
  5. , uint64_t
  6. , sint8_t
  7. , sint16_t
  8. , sint32_t
  9. , sint64_t
  10. , bool_t
  11. , float_t
  12. , double_t
  13. , baseTypeEnv
  14. ) where
  15. import Gidl.Types.AST
  16. uint8_t :: Type
  17. uint8_t = AtomType (AtomWord Bits8)
  18. uint16_t :: Type
  19. uint16_t = AtomType (AtomWord Bits16)
  20. uint32_t :: Type
  21. uint32_t = AtomType (AtomWord Bits32)
  22. uint64_t :: Type
  23. uint64_t = AtomType (AtomWord Bits64)
  24. sint8_t :: Type
  25. sint8_t = AtomType (AtomInt Bits8)
  26. sint16_t :: Type
  27. sint16_t = AtomType (AtomInt Bits16)
  28. sint32_t :: Type
  29. sint32_t = AtomType (AtomInt Bits32)
  30. sint64_t :: Type
  31. sint64_t = AtomType (AtomInt Bits64)
  32. bool_t :: Type
  33. bool_t = EnumType (EnumT Bits8 [("false", 0), ("true", 1)])
  34. float_t :: Type
  35. float_t = AtomType AtomFloat
  36. double_t :: Type
  37. double_t = AtomType AtomDouble
  38. baseTypeEnv :: TypeEnv
  39. baseTypeEnv = TypeEnv
  40. [ ( "uint8_t" , uint8_t)
  41. , ( "uint16_t", uint16_t)
  42. , ( "uint32_t", uint32_t)
  43. , ( "uint64_t", uint64_t)
  44. , ( "sint8_t" , sint8_t)
  45. , ( "sint16_t", sint16_t)
  46. , ( "sint32_t", sint32_t)
  47. , ( "sint64_t", sint64_t)
  48. , ( "bool_t" , bool_t)
  49. , ( "float_t" , float_t)
  50. , ( "double_t", double_t)
  51. ]