| Portability | ghc |
|---|---|
| Stability | experimental |
| Maintainer | benedikt.huber@gmail.com |
| Safe Haskell | None |
Language.C.Parser
Description
Language.C parser
- parseC :: InputStream -> Position -> Either ParseError CTranslUnit
- data P a
- execParser :: P a -> InputStream -> Position -> [Ident] -> [Name] -> Either ParseError (a, [Name])
- execParser_ :: P a -> InputStream -> Position -> Either ParseError a
- builtinTypeNames :: [Ident]
- translUnitP :: P CTranslUnit
- extDeclP :: P CExtDecl
- statementP :: P CStat
- expressionP :: P CExpr
- newtype ParseError = ParseError ([String], Position)
Simple API
parseC :: InputStream -> Position -> Either ParseError CTranslUnitSource
parseC input initialPos parses the given preprocessed C-source input and returns the AST or a list of parse errors.
Parser Monad
execParser :: P a -> InputStream -> Position -> [Ident] -> [Name] -> Either ParseError (a, [Name])Source
execute the given parser on the supplied input stream.
returns ParseError if the parser failed, and a pair of
result and remaining name supply otherwise
Synopsis: execParser parser inputStream initialPos predefinedTypedefs uniqNameSupply
execParser_ :: P a -> InputStream -> Position -> Either ParseError aSource
run the given parser using a new name supply and builtin typedefs
see execParser
Synopsis: runParser parser inputStream initialPos
Exposed Parsers
translUnitP :: P CTranslUnitSource
translUnitP provides a parser for a complete C translation unit, i.e. a list of external declarations.
statementP provides a parser for C statements
expressionP provides a parser for C expressions