Skip to content

siraben/c-dsl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A higher level DSL for writing C in Haskell on top of language-c.

As a trivial example

{-# LANGUAGE OverloadedStrings #-}
import Language.C.DSL
test =
   fun [intTy] "test"[int "a", int "b"] $ hblock [
       creturn ("a" + "b")
  ]

Now we could fire up GHCi and run

>>> pretty test
int test(int a, int b)
{
   return a + b;
}

to see the resulting C.

For more examples consult the examples/ directory.

About

a dsl for generating C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 100.0%