c-dsl-0.3: A higher level DSL on top of language-c

Safe HaskellNone
LanguageHaskell2010

Language.C.DSL

Description

This module provides a more pleasant way to write C ASTs for language-c As a simple example,

{-# LANGUAGE OverloadedStrings #-}

import Language.C.DSL

example :: CFunDef
example =
  fun [intTy] "foo"[int "a", int "b"] $ block [
      creturn $ "a" + "b"
  ]

And when loaded into GHCi

Main*> pretty example
int foo(int a, int b)
{
  return a + b;
}

This module also exports Language.C for simplicity.

Documentation

module Language.C