@@ -1,5 +1,7 @@
|
||||
# qbe-hs
|
||||
|
||||
**fork of [qbe-hs](https://git.sr.ht/~fgaz/qbe-hs)**
|
||||
|
||||
[](https://hackage.haskell.org/package/qbe)
|
||||
[](https://builds.sr.ht/~fgaz/qbe-hs/commits/master?)
|
||||
|
||||
|
||||
@@ -39,11 +39,15 @@ common common
|
||||
-Wredundant-constraints
|
||||
-Wincomplete-uni-patterns
|
||||
-Wincomplete-record-updates
|
||||
-fdefer-type-errors
|
||||
-fno-show-valid-hole-fits
|
||||
-fdefer-out-of-scope-variables
|
||||
-Wno-typed-holes
|
||||
default-language: Haskell2010
|
||||
|
||||
library
|
||||
import: common
|
||||
exposed-modules: Language.QBE
|
||||
exposed-modules: Language.QBE Language.QBE.QQ
|
||||
-- other-modules:
|
||||
other-extensions: DataKinds
|
||||
KindSignatures
|
||||
@@ -67,6 +71,8 @@ library
|
||||
|| ^>= 1.5.0
|
||||
, deepseq ^>= 1.4.4 || ^>= 1.5
|
||||
, prettyprinter ^>= 1.7.1
|
||||
, megaparsec ^>= 9.7.0
|
||||
, template-haskell
|
||||
hs-source-dirs: src
|
||||
|
||||
test-suite golden
|
||||
|
||||
43
src/Language/QBE/QQ.hs
Normal file
43
src/Language/QBE/QQ.hs
Normal file
@@ -0,0 +1,43 @@
|
||||
{-# 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 = _
|
||||
}
|
||||
Reference in New Issue
Block a user