Skip to content
View laserpants's full-sized avatar

Block or report laserpants

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
laserpants/README.md

My projects

Coal

Coal is a statically typed, purely functional programming language with Hindley–Milner type system, algebraic data types, extensible records, traits, and codata. The Coal compiler is implemented in Haskell.

See the official website for a language manual and getting started instructions:

Website: coal-lang.org

Packages

Name Description
📦 coal-containers A collection of functional data structures for the Coal programming language, providing efficient implementations of common container types.
📦 coal-json A JSON library for the Coal programming language, providing encoding, decoding, and pretty-printing of JSON values with composable decoder combinators and typeclass-based serialization.
📦 coal-monads A collection of common monad implementations for the Coal programming language.

IR Builder

A Haskell library for constructing LLVM IR programmatically. It provides a monadic DSL for building modules, functions, blocks, and instructions, along with a pure renderer that serializes the result to LLVM assembly

You describe an IR module using the IRBuilder monad. When you run compileModule, the builder produces an IRModule value. renderModule then converts that value to the textual LLVM IR format that can be passed to llc, clang, or lli. For example:

import LLVM.IR

example :: IRBuilder ()
example = do
  define i32 "add_one" [(i32, "x")] LExternal [] $ do
    beginBlock "entry"
    r <- add i32 (OLocal i32 "x") (OConstant (CInt 32 1))
    ret r

Running compileModule "example" example produces:

define i32 @add_one(i32 %x) {
entry:
  %1 = add i32 %x, 1
  ret i32 %1
}

Buy me a coffee

Pinned Loading

  1. coal coal Public

    Read-only mirror of https://codeberg.org/laserpants/coal

    Haskell

  2. ir-builder ir-builder Public

    Read-only mirror of https://codeberg.org/laserpants/ir-builder

    Haskell