-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Went back to Parsec, added pretty-printer
- Loading branch information
Showing
10 changed files
with
274 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,57 @@ | ||
{-# LANGUAGE | ||
TemplateHaskell | ||
, QuasiQuotes | ||
, FlexibleContexts | ||
, FlexibleInstances | ||
#-} | ||
|
||
module Grammar | ||
( Top(..) | ||
, Term(..) | ||
, Handler(..) | ||
, OpDef(..) | ||
, Val(..) | ||
, Typ(..) | ||
, Row(..) | ||
, TVar(..) | ||
, TyVar(..) | ||
, TyLit(..) | ||
, Ident(..) | ||
, pShow | ||
) where | ||
|
||
import Control.Monad.Except | ||
import Language.LBNF.Runtime(printTree) | ||
import Language.LBNF.Compiletime | ||
import Data.Text | ||
|
||
newtype TyVar = TV Text deriving (Show, Eq, Ord) | ||
newtype TyLit = TL Text deriving (Show, Eq, Ord) | ||
newtype Ident = ID Text deriving (Show, Eq, Ord) | ||
|
||
data Top | ||
= Def Ident Term | ||
| Run Term | ||
| EffDef TyLit [OpDef] | ||
deriving Show | ||
|
||
data OpDef = OpDef Ident Typ Typ | ||
deriving Show | ||
|
||
data Term | ||
= App Term Term | ||
| Let Ident Term Term | ||
| Abs Ident Term | ||
| Var Ident | ||
| Lit Val | ||
| Handle TyLit Term [Handler] | ||
| Lift TyLit Term | ||
| Bind Ident Term Term | ||
deriving Show | ||
|
||
data Handler | ||
= Op Ident Ident Ident Term | ||
| Ret Ident Term | ||
deriving Show | ||
|
||
data Val | ||
= VInt Integer | ||
| VUnit | ||
deriving Show | ||
|
||
data Typ | ||
= TyArr Typ Row Typ | ||
| TyVar TyVar | ||
| TyLit TyLit | ||
deriving Show | ||
|
||
import Grammar.Impl | ||
data Row = Row [TyLit] (Maybe TyVar) | ||
deriving Show |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.