44 lines
820 B
Haskell
44 lines
820 B
Haskell
{-# LANGUAGE RankNTypes, TypeAbstractions, OverloadedStrings, ScopedTypeVariables #-}
|
||
module Language.QBE.QQ
|
||
( qbe
|
||
)
|
||
where
|
||
|
||
import qualified Language.Haskell.TH as TH
|
||
import Language.Haskell.TH.Quote
|
||
import Data.Void
|
||
import Text.Megaparsec
|
||
import Text.Megaparsec.Char
|
||
import qualified Text.Megaparsec.Char.Lexer as L
|
||
import Language.QBE
|
||
import Data.Proxy
|
||
|
||
|
||
type P = Parsec Void String
|
||
|
||
space = L.space space1 empty empty
|
||
lexeme = L.lexeme space1
|
||
symbol = L.symbol space1
|
||
|
||
ident :: Sigil -> P (Ident t)
|
||
ident (Proxy @t) = do
|
||
case t of
|
||
AggregateTy -> char ':'
|
||
Ident <$> ""
|
||
|
||
assignment :: P Assignment
|
||
assignment = do
|
||
ident
|
||
|
||
assignmentInst :: P Inst
|
||
assignmentInst = _
|
||
|
||
qbeQuoteExp :: String -> TH.ExpQ
|
||
qbeQuoteExp = _
|
||
|
||
qbe :: QuasiQuoter
|
||
qbe = QuasiQuoter
|
||
{ quoteExp = qbeQuoteExp
|
||
, quotePat = _
|
||
}
|