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

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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]

Properties

Versions 1.1.0.0, 1.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.14 && <4.16 || >=4.16.1.0 && <4.17), 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>
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-10T10:05:24Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


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