language-c99-simple-0.3.0: C-like AST to simplify writing C99 programs.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Language.C99.Simple.AST

# Documentation

type Ident = String Source #

data TransUnit Source #

Constructors

TransUnit [Decln] [FunDef] |

data FunDef Source #

Constructors

FunDef (Maybe StorageSpec) Type Ident [Param] [Decln] [Stmt] |

data Param Source #

Constructors

Param Type Ident |

data Decln Source #

Constructors

VarDecln (Maybe StorageSpec) Type Ident (Maybe Init) |
FunDecln (Maybe StorageSpec) Type Ident [Param] |
TypeDecln Type |

data StorageSpec Source #

Constructors

Typedef |
Extern |
Static |
Auto |
Register |

data Type Source #

Constructors

Type Type |
TypeSpec TypeSpec |
Ptr Type |
Array Type (Maybe Expr) |
Const Type |
Restrict Type |
Volatile Type |

data TypeSpec Source #

Constructors

Void |
Char |
Signed_Char |
Unsigned_Char |
Short |
Signed_Short |
Short_Int |
Signed_Short_Int |
Unsigned_Short |
Unsigned_Short_Int |
Int |
Signed |
Signed_Int |
Unsigned |
Unsigned_Int |
Long |
Signed_Long |
Long_Int |
Signed_Long_Int |
Unsigned_Long |
Unsgined_Long_Int |
Long_Long |
Signed_Long_Long |
Long_Long_Int |
Signed_Long_Long_Int |
Unsigned_Long_Long |
Unsigned_Long_Long_Int |
Float |
Double |
Long_Double |
Bool |
Float_Complex |
Double_Complex |
Long_Double_Complex |
TypedefName Ident |
Struct Ident |
StructDecln (Maybe Ident) (NonEmpty FieldDecln) |
Union Ident |
UnionDecln (Maybe Ident) (NonEmpty FieldDecln) |
Enum Ident |
EnumDecln (Maybe Ident) (NonEmpty Ident) |

data FieldDecln Source #

Constructors

FieldDecln Type Ident |

data Init Source #

Constructors

InitExpr Expr |
InitList (NonEmpty InitItem) |

data InitItem Source #

Constructors

InitItem (Maybe Ident) Init |

data Expr Source #

Constructors

Ident Ident |
LitBool Bool |
LitInt Integer |
LitFloat Float |
LitDouble Double |
LitString String |
Index Expr Expr |
Funcall Expr [Expr] |
Dot Expr Ident |
Arrow Expr Ident |
InitVal TypeName (NonEmpty InitItem) |
UnaryOp UnaryOp Expr |
Cast TypeName Expr |
BinaryOp BinaryOp Expr Expr |
Cond Expr Expr Expr |
AssignOp AssignOp Expr Expr |
SizeOf Expr |
SizeOfType TypeName |

data UnaryOp Source #

Constructors

Inc |
Dec |
Ref |
DeRef |
Plus |
Min |
BoolNot |
Not |

data BinaryOp Source #

Constructors

Mult |
Div |
Mod |
Add |
Sub |
ShiftL |
ShiftR |
LT |
GT |
LE |
GE |
Eq |
NEq |
And |
XOr |
Or |
LAnd |
LOr |

data AssignOp Source #

Constructors

Assign |
AssignMult |
AssignDiv |
AssignMod |
AssignAdd |
AssignSub |
AssignShiftL |
AssignShiftR |
AssignAnd |
AssignXOr |
AssignOr |

data TypeName Source #

Constructors

TypeName Type |

data Case Source #

Constructors

Case Expr Stmt |
Default Stmt |

data Stmt Source #

Constructors

Expr Expr |
If Expr [Stmt] |
IfElse Expr [Stmt] [Stmt] |
Switch Expr [Case] |
While Expr [Stmt] |
For Expr Expr Expr [Stmt] |
ForInf [Stmt] |
Continue |
Break |
Label String Stmt |
Return (Maybe Expr) |