less prototype, less bad code implementation of CCHM type theory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
940 B

  1. module Presyntax.Presyntax where
  2. import Data.Text (Text)
  3. data Plicity
  4. = Im | Ex
  5. deriving (Eq, Show, Ord)
  6. data Expr
  7. = Var Text
  8. | App Plicity Expr Expr
  9. | Pi Plicity Text Expr Expr
  10. | Lam Plicity Text Expr
  11. | Sigma Text Expr Expr
  12. | Pair Expr Expr
  13. | Proj1 Expr
  14. | Proj2 Expr
  15. -- application of IsOne primitive is written like [ φ ]
  16. | Bracket Expr
  17. -- System
  18. | LamSystem [(Formula, Expr)]
  19. | Span Expr Posn Posn
  20. deriving (Eq, Show, Ord)
  21. data Formula
  22. = FIs1 Text
  23. | FIs0 Text
  24. | FAnd Formula Formula
  25. | FOr Formula Formula
  26. | FTop
  27. | FBot
  28. deriving (Eq, Show, Ord)
  29. data Statement
  30. = Decl [Text] Expr
  31. | Defn Text Expr
  32. | Builtin Text Text
  33. | ReplNf Expr -- REPL eval
  34. | ReplTy Expr -- REPL :t
  35. | SpanSt Statement Posn Posn
  36. deriving (Eq, Show, Ord)
  37. data Posn
  38. = Posn { posnLine :: {-# UNPACK #-} !Int
  39. , posnColm :: {-# UNPACK #-} !Int
  40. }
  41. deriving (Eq, Show, Ord)