This commit is contained in:
2026-04-24 08:54:09 -06:00
parent 540a5e03fe
commit beccb5d650
3 changed files with 52 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
# qbe-hs
**fork of [qbe-hs](https://git.sr.ht/~fgaz/qbe-hs)**
[![Hackage](https://img.shields.io/hackage/v/qbe.svg)](https://hackage.haskell.org/package/qbe)
[![builds.sr.ht status](https://builds.sr.ht/~fgaz/qbe-hs/commits/master.svg)](https://builds.sr.ht/~fgaz/qbe-hs/commits/master?)

View File

@@ -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
@@ -63,6 +67,8 @@ library
, hashable ^>= 1.4.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
View 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 = _
}