Safe Haskell | None |
---|---|
Language | Haskell2010 |
C code generation for Program
- module Language.Embedded.Backend.C.Expression
- namedType :: String -> Type
- viewNotExp :: Exp -> Maybe Exp
- arrayInit :: [Exp] -> Initializer
- compile :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> String
- compileAll :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> [(String, String)]
- icompile :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO ()
- icompileAll :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO ()
- removeFileIfPossible :: FilePath -> IO ()
- data ExternalCompilerOpts = ExternalCompilerOpts {}
- defaultExtCompilerOpts :: ExternalCompilerOpts
- maybePutStrLn :: Bool -> String -> IO ()
- compileC :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO FilePath
- compileAndCheck' :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO ()
- compileAndCheck :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO ()
- runCompiled' :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO ()
- runCompiled :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO ()
- captureCompiled' :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> String -> IO String
- captureCompiled :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> String -> IO String
- compareCompiled' :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO a -> String -> IO ()
- compareCompiled :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO a -> String -> IO ()
Documentation
Utilities
viewNotExp :: Exp -> Maybe Exp Source
Return the argument of a boolean negation expression
arrayInit :: [Exp] -> Initializer Source
Code generation user interface
compile :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> String Source
Compile a program to C code represented as a string
This function returns only the first (main) module.
To get every C translation units, use compileAll
.
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
compileAll :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> [(String, String)] Source
icompile :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO () Source
Compile a program to C code and print it on the screen
This function returns only the first (main) module.
To get every C translation units, use icompileAll
.
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
icompileAll :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO () Source
removeFileIfPossible :: FilePath -> IO () Source
data ExternalCompilerOpts Source
ExternalCompilerOpts | |
|
maybePutStrLn :: Bool -> String -> IO () Source
:: (Interp instr CGen (Param2 exp pred), HFunctor instr) | |
=> ExternalCompilerOpts | |
-> Program instr (Param2 exp pred) a | Program to compile |
-> IO FilePath | Path to the generated executable |
Generate C code and use GCC to compile it
compileAndCheck' :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO () Source
Generate C code and use GCC to check that it compiles (no linking)
compileAndCheck :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO () Source
Generate C code and use GCC to check that it compiles (no linking)
runCompiled' :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO () Source
Generate C code, use GCC to compile it, and run the resulting executable
runCompiled :: (Interp instr CGen (Param2 exp pred), HFunctor instr) => Program instr (Param2 exp pred) a -> IO () Source
Generate C code, use GCC to compile it, and run the resulting executable
:: (Interp instr CGen (Param2 exp pred), HFunctor instr) | |
=> ExternalCompilerOpts | |
-> Program instr (Param2 exp pred) a | Program to run |
-> String | Input to send to |
-> IO String | Result from |
Like runCompiled'
but with explicit input/output connected to
stdin
/stdout
:: (Interp instr CGen (Param2 exp pred), HFunctor instr) | |
=> Program instr (Param2 exp pred) a | Program to run |
-> String | Input to send to |
-> IO String | Result from |
Like runCompiled
but with explicit input/output connected to
stdin
/stdout