qbe: Types and prettyprinter for the IL of the QBE compiler backend

[ bsd3, language, library ] [ Propose Tags ]

This library provides types representing the intermediate language of the QBE compiler backend. It also provides pretty-printing instances based on the <code>prettyprinter</code> library, that emit the textual representation of the IL.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 1.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.14 && <4.16 || >=4.16.1.0 && <4.18), bytestring (>=0.11.3 && <0.12), deepseq (>=1.4.4 && <1.5), hashable (>=1.4.0 && <1.5), prettyprinter (>=1.7.1 && <1.8), text (>=1.2.5 && <1.3 || >=2.0 && <2.1), text-short (>=0.1 && <0.2) [details]
License BSD-3-Clause
Copyright 2022 Francesco Gazzetta
Author Francesco Gazzetta
Maintainer Francesco Gazzetta <fgaz@fgaz.me>
Revised Revision 1 made by fgaz at 2023-01-05T11:23:13Z
Category Language
Home page https://sr.ht/~fgaz/qbe-hs
Bug tracker https://todo.sr.ht/~fgaz/qbe-hs
Source repo head: git clone https://git.sr.ht/~fgaz/qbe-hs
Uploaded by fgaz at 2022-07-10T20:29:59Z
Distributions NixOS:1.1.0.0
Downloads 35 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-07-10 [all 1 reports]

Readme for qbe-1.1.0.0

[back to package description]

qbe-hs

Hackage builds.sr.ht status

Haskell types and prettyprinter for the IL of the QBE compiler backend

Example

helloWorld :: Program
helloWorld = Program [] [helloString] [helloMain]
  where
    helloString = DataDef [] "str" Nothing
      [ FieldExtTy Byte $ String "hello world" :| []
      , FieldExtTy Byte $ Const (CInt False 0) :| []
      ]
    helloMain = FuncDef [Export] (Just $ AbiBaseTy Word) "main"
      Nothing [] NoVariadic $
      Block "start"
        []
        [ Call (Just ("r", AbiBaseTy Word)) (ValGlobal "puts")
            Nothing
            [Arg (AbiBaseTy Long) $ ValGlobal "str"]
            []
        ]
        (Ret $ Just $ ValConst $ CInt False 0)
      :| []

Gets rendered to

data $str =
{b "hello world", b 0}
export
function w $main () {
@start
    %r =w call $puts (l $str)
    ret 0
}

Contributing

You can send patches to my public-inbox mailing list or to any of the contacts listed at fgaz.me/about. Or you can send a pull request to the GitHub mirror.

Issues are tracked at https://todo.sr.ht/~fgaz/qbe-hs