imperative-edsl-0.4.1: Deep embedding of imperative programs with code generation

Safe HaskellNone
LanguageHaskell2010

Language.Embedded.Backend.C

Contents

Description

C code generation for Program

Synopsis

Utilities

namedType :: String -> Type Source

Create a named type

viewNotExp :: Exp -> Maybe Exp Source

Return the argument of a boolean negation expression

Code generation user interface

compile :: (Interp instr CGen, HFunctor instr) => Program instr a -> String Source

Compile a program to C code represented as a string

For programs that make use of the primitives in Language.Embedded.Concurrent, the resulting C code can be compiled as follows:

gcc -Iinclude csrc/chan.c -lpthread YOURPROGRAM.c

icompile :: (Interp instr CGen, HFunctor instr) => Program instr a -> IO () Source

Compile a program to C code and print it on the screen

For programs that make use of the primitives in Language.Embedded.Concurrent, the resulting C code can be compiled as follows:

gcc -Iinclude csrc/chan.c -lpthread YOURPROGRAM.c