Created
November 30, 2014 20:01
-
-
Save dadrian/795584da6710fced40cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Language.C | |
import Language.C.System.GCC -- preprocessor used | |
import Language.C.Syntax.AST | |
main = parseMyFile "header.h" >>= printMyAST | |
parseMyFile :: FilePath -> IO CTranslUnit | |
parseMyFile input_file = | |
do parse_result <- parseCFile (newGCC "gcc") Nothing ["-U__BLOCKS__"] input_file | |
case parse_result of | |
Left parse_err -> error (show parse_err) | |
Right ast -> return ast | |
printMyAST :: CTranslUnit -> IO () | |
printMyAST ctu = (print . pretty) ctu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build-depends: language=c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment