-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An interface to CIL. -- -- CIL is a simplified, intermediate language for C. CIL makes a great -- frontend for C analysis, instrumentation, and compilation tools. @package cil @version 0.1.1 module Language.CIL.Types -- | Identifiers. type Name = String -- | Types. data Type Void :: Type Array :: Int -> Type -> Type Ptr :: Type -> Type -- | A volatile qualified type. Volatile :: Type -> Type Typedef :: Type -> Type Struct :: [(Name, Type)] -> Type Union :: [(Name, Type)] -> Type Enum :: [(Name, Int)] -> Type BitField :: Type -> [(Name, Int)] -> Type -- | Reference to a struct type. StructRef :: Name -> Type -- | Reference to a union type. UnionRef :: Name -> Type -- | Reference to an enum type. EnumRef :: Name -> Type -- | Reference to a previously defined typedef. TypedefRef :: Name -> Type Function :: Type -> [Type] -> Type Int8 :: Type Int16 :: Type Int32 :: Type Word8 :: Type Word16 :: Type Word32 :: Type Float :: Type Double :: Type -- | Expressions. data Expr ConstInt :: Int -> Position -> Expr ConstFloat :: Double -> Position -> Expr ConstChar :: Char -> Position -> Expr ConstString :: String -> Position -> Expr -- | Variable reference. Var :: Name -> Position -> Expr -- | a * b Mul :: Expr -> Expr -> Position -> Expr -- | a / b Div :: Expr -> Expr -> Position -> Expr -- | a % b Rmd :: Expr -> Expr -> Position -> Expr -- | a + b Add :: Expr -> Expr -> Position -> Expr -- | a - b Sub :: Expr -> Expr -> Position -> Expr -- | a << b Shl :: Expr -> Expr -> Position -> Expr -- | a >> b Shr :: Expr -> Expr -> Position -> Expr -- | a < b Lt :: Expr -> Expr -> Position -> Expr -- | a > b Gt :: Expr -> Expr -> Position -> Expr -- | a <= b Le :: Expr -> Expr -> Position -> Expr -- | a >= b Ge :: Expr -> Expr -> Position -> Expr -- | a == b Eq :: Expr -> Expr -> Position -> Expr -- | a != b Neq :: Expr -> Expr -> Position -> Expr -- | a & b And :: Expr -> Expr -> Position -> Expr -- | a ^ b Xor :: Expr -> Expr -> Position -> Expr -- | a | b Or :: Expr -> Expr -> Position -> Expr -- | &a Adr :: Expr -> Position -> Expr -- | *a Ind :: Expr -> Position -> Expr -- | -a Minus :: Expr -> Position -> Expr -- | ~a Comp :: Expr -> Position -> Expr -- | !a Neg :: Expr -> Position -> Expr -- | (...) a Cast :: Type -> Expr -> Position -> Expr -- | a[b] Index :: Expr -> Expr -> Position -> Expr -- | a.name Mem :: Expr -> Name -> Position -> Expr -- | a->name MemInd :: Expr -> Name -> Position -> Expr -- | sizeof(type) SizeT :: Type -> Position -> Expr -- | sizeof(expr) SizeE :: Expr -> Position -> Expr -- | Initialization expressions. data Init Init :: Expr -> Init InitList :: [Init] -> Init -- | Function application. data Apply Apply :: Expr -> [Expr] -> Apply instance Show Apply instance Eq Apply instance Show Init instance Eq Init instance Show Expr instance Eq Expr instance Show Type instance Eq Type instance Pos Expr module Language.CIL.StmtCore -- | Statements. data Stmt Null :: Stmt Compound :: [Name] -> [Stmt] -> Position -> Stmt TypeDecl :: Name -> Type -> Position -> Stmt VariableDef :: Name -> Type -> (Maybe Init) -> Position -> Stmt FunctionDef :: Name -> Type -> [(Name, Type)] -> Stmt -> Position -> Stmt AssignApply :: Expr -> Apply -> Position -> Stmt AssignExpr :: Expr -> Expr -> Position -> Stmt StmtApply :: Apply -> Position -> Stmt While :: Expr -> Stmt -> Position -> Stmt If :: Expr -> Stmt -> Stmt -> Position -> Stmt Return :: (Maybe Expr) -> Position -> Stmt Goto :: Name -> Position -> Stmt Break :: Position -> Stmt Switch :: Expr -> Stmt -> Position -> Stmt Case :: Expr -> Stmt -> Position -> Stmt Default :: Stmt -> Position -> Stmt instance Show Stmt instance Eq Stmt instance Pos Stmt module Language.CIL.StmtGoto -- | Statements. data Stmt Null :: Stmt Compound :: [Name] -> [Stmt] -> Position -> Stmt TypeDecl :: Name -> Type -> Position -> Stmt VariableDef :: Name -> Type -> (Maybe Init) -> Position -> Stmt AssignExpr :: Expr -> Expr -> Position -> Stmt If :: Expr -> Stmt -> Stmt -> Position -> Stmt Goto :: Name -> Position -> Stmt instance Show Stmt instance Eq Stmt instance Pos Stmt module Language.CIL.Parse -- | Parses a merged CIL program, given a file name and contents. parseCIL :: String -> ByteString -> Stmt -- | Format the file position of something with ties to the orignial -- source, like a Stmt or Expr. position :: (Pos a) => a -> String -- | Parsing the C Intermediate Language (CIL). CIL provides a manageable -- means to analyze and compile C code. -- -- The common method to reduce C to CIL is to use the cilly driver: -- --
--   cilly --merge --keepmerged { c-files-and-options }
--   
-- -- http://cil.sourceforge.net/ module Language.CIL