language-c-0.8.2: Analysis and generation of C code

Copyright(c) 2008 Benedikt Huber
LicenseBSD-style
Maintainerbenedikt.huber@gmail.com
Stabilityalpha
Portabilityghc
Safe HaskellNone
LanguageHaskell98

Language.C.Analysis.AstAnalysis

Contents

Description

Analyse the parse tree

Traverses the AST, analyses declarations and invokes handlers.

Synopsis

Top-level analysis

analyseAST :: MonadTrav m => CTranslUnit -> m GlobalDecls #

Analyse the given AST

analyseAST ast results in global declaration dictionaries. If you want to perform specific actions on declarations or definitions, you may provide callbacks in the MonadTrav m.

Returns the set of global declarations and definitions which where successfully translated. It is the users responsibility to check whether any hard errors occurred (runTrav does this for you).

analyseExt :: MonadTrav m => CExtDecl -> m () #

Analyse an top-level declaration

analyseFunDef :: MonadTrav m => CFunDef -> m () #

Analyse a function definition

analyseDecl :: MonadTrav m => Bool -> CDecl -> m () #

Analyse a declaration other than a function definition

Note: static assertions are not analysed

Building blocks for additional analyses

Type checking

tExpr :: MonadTrav m => [StmtCtx] -> ExprSide -> CExpr -> m Type #

data ExprSide #

Constructors

LValue 
RValue 
Instances
Eq ExprSide # 
Instance details

Defined in Language.C.Analysis.AstAnalysis

Show ExprSide # 
Instance details

Defined in Language.C.Analysis.AstAnalysis

tStmt :: MonadTrav m => [StmtCtx] -> CStat -> m Type #

Typecheck a statement, given a statement context. The type of a statement is usually void, but expression statements and blocks can sometimes have other types.

data StmtCtx #