{"id":20128704,"url":"https://github.com/llvm-hs/llvm-hs-quote","last_synced_at":"2026-02-28T16:31:14.908Z","repository":{"id":79361987,"uuid":"113981029","full_name":"llvm-hs/llvm-hs-quote","owner":"llvm-hs","description":"Quasiquoter for LLVM","archived":false,"fork":false,"pushed_at":"2018-04-14T12:03:06.000Z","size":115,"stargazers_count":31,"open_issues_count":6,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-23T18:05:36.848Z","etag":null,"topics":["code-generation","llvm","llvm-hs","llvm-ir","quasiquoter"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/llvm-hs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-12T11:16:13.000Z","updated_at":"2024-08-11T00:41:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7592af4-3050-464d-85bd-659334ad65e3","html_url":"https://github.com/llvm-hs/llvm-hs-quote","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llvm-hs%2Fllvm-hs-quote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llvm-hs%2Fllvm-hs-quote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llvm-hs%2Fllvm-hs-quote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llvm-hs%2Fllvm-hs-quote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llvm-hs","download_url":"https://codeload.github.com/llvm-hs/llvm-hs-quote/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248063902,"owners_count":21041854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generation","llvm","llvm-hs","llvm-ir","quasiquoter"],"created_at":"2024-11-13T20:28:52.135Z","updated_at":"2026-02-28T16:31:09.659Z","avatar_url":"https://github.com/llvm-hs.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"llvm-hs-quote\n=============\n\n[![Build Status](https://travis-ci.org/llvm-hs/llvm-hs-quote.svg?branch=master)](https://travis-ci.org/llvm-hs/llvm-hs-quote)\n\n`llvm-hs-quote` is a quasiquoting-library for llvm-hs.  It aims to support\nall language constructs of LLVM.\n\n`llvm-hs-quote` provides both quasiquotes and antiquotes. The following trivial\nexample uses both a quasiquote and an antiquote.\n\n```haskell\nalloc :: Type -\u003e Instruction\nalloc t = [lli|alloca $type:t|]\n```\n\n`LLVM.Quote.LLVM` provides quasiquoters or antiquoters for the following types.\nFor each type `a`, there's also a corresponding quasiquoter or antiquoter for\n`CodeGen a` with an `M` added to the end of the name. For example,\n`Definition`'s quasiquoter is `lldef`; the corresponding quasiquoter for\n`CodeGen Definition` is `lldefM`. Its antiquoter is `$def:`; the corresponding\nantiquoter for `CodeGen Definition` is `$defM:`.\n\nAST Type                             | Quasiquoter | Antiquoter\n-------------------------------------| ----------- | ----------\n`LLVM.AST.Module`                    | `llmod`     |\n`LLVM.AST.Definition`                | `lldef`     | `$def:`\n`[LLVM.AST.Definition]`              |             | `$defs:`\n`LLVM.AST.Global`                    | `llg`       |\n`LLVM.AST.Instruction.Instruction`   | `lli`       | `$instr:`\n`[LLVM.AST.Instruction.Instruction]` |             | `$instrs:`\n`LLVM.AST.Instruction.Terminator`    | `llt`       | `$instr:`\n`LLVM.AST.DataLayout.DataLayout`     |             | `$dl:`\n`LLVM.Quote.AST.TargetTriple`        |             | `$tt:`\n`LLVM.AST.BasicBlock`                |             | `$bb:`\n`[LLVM.AST.BasicBlock]`              |             | `$bbs:`\n`LLVM.AST.Type.Type`                 |             | `$type:`\n`LLVM.AST.Operand.Operand`           |             | `$opr:`\n`LLVM.AST.Constant.Constant`         |             | `$const:`\n`LLVM.AST.Name.Name` (local)         |             | `$id:`\n`LLVM.AST.Name.Name` (global)        |             | `$gid:`\n`LLVM.AST.Parameter`                 |             | `$param:`\n`[LLVM.AST.Parameter]`               |             | `$params:`\n\nExamples\n--------\n\n### Module Quasiquoter\n\n```haskell\n{-# LANGUAGE QuasiQuotes #-}\n{-# LANGUAGE OverloadedStrings #-}\n\nimport LLVM.AST as AST\nimport LLVM.Quote.LLVM as Q\n\n-- | Module quotation\nexample1 :: AST.Module\nexample1 = [Q.llmod|\n; ModuleID = 'simple module'\n\ndefine i32 @foo(i32 %x) {\nentry:\n  %x.addr = alloca i32\n  store i32 %x, i32* %x.addr\n  ret i32 1001\n}\n|]\n```\n\n### Instruction Antiquotes\n\n```haskell\n-- | Instruction antiquotation\nexample2 :: Either AST.Instruction AST.Terminator -\u003e AST.Module\nexample2 instructionOrTerminator = [Q.llmod|\n  ; ModuleID = 'simple module'\n  define i32 @myfunc(){\n  entry:\n    $instr:instructionOrTerminator\n    ret i32 0\n  }\n|]\n```\n\n### Instruction Quotation\n\n```haskell\n-- | Instruction quotation\nexample3 :: AST.Type -\u003e AST.Instruction\nexample3 t = [Q.lli|alloca $type:t|]\n```\n\n### Definition Quotation\n\n```haskell\n-- | Definition quotation\nexample4 :: AST.Definition\nexample4 = [Q.lldef|@0 = global i32 1|]\n```\n\nLicense\n-------\n\nCopyright (c) 2014, Timo von Holtz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllvm-hs%2Fllvm-hs-quote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllvm-hs%2Fllvm-hs-quote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllvm-hs%2Fllvm-hs-quote/lists"}