C# (CSharp) AST Namespace

Classes

Name Description
Add Addition There are two kinds of addition: 1. both operands are of arithmetic Type 2. one operand is a pointer, and the other is an integral
AddAssign AddAssign: a += b
AssignOp Assignment operator
Assignment Assignment: Left = Right
AssignmentList A list of assignment expressions. e.g. a = 3, b = 4;
Attribute expr.name: expr must be a struct or union.
BasicTypeSpec
BinaryArithmeticOp Binary integral operator: takes in two int/uint/float/double, returns an int/uint/float/double.
BinaryIntegralOp Binary integral operator: takes in two integrals, returns an integer.
BinaryLogicalOp Binary logical operator: first turn pointers to ulongs, then always returns long.
BinaryOp Binary operator: Left op Right
BitwiseAnd Bitwise And: returns an integer.
BitwiseAndAssign BitwiseAndAssign: a &= b
BitwiseNot ~expr: only takes integral type. After semantic analysis, only the following 2 types are possible: 1) long 2) ulong
BitwiseOr Bitwise Or: accepts two integrals, returns an integer.
BitwiseOrAssign BitwiseOrAssign: a |= b
BreakStmt Break Statement
CaseStmt Case Statement
CompoundStmt
ConditionalExpression Conditional Expression Cond ? true_expr : false_expr Cond must be of scalar Type 1. if both true_expr and false_expr have arithmetic types perform usual arithmetic conversion 2.
ContStmt Continue Statement
Decln declaration : declaration-specifiers [Init-declarator-list]? ';'
DeclnSpecs declaration-specifiers : [ storage-class-specifier | Type-specifier | Type-qualifier ]+
DefaultStmt
Dereference
DivAssign DivAssign: a /= b
Divide Division: perform usual arithmetic conversion.
DoWhileStmt Do-while Stmt do { body } while (cond); cond must be of scalar type
EnumSpec enum-specifier : enum [identifier]? '{' enumerator-list '}' | enum identifier enumerator-list : enumerator [ ',' enumerator ]*
Enumr enumerator : enumeration-constant [ '=' constant-expression ]? enumeration-constant : identifier
Equal Equal
Expr The cdecl calling convention: 1. arguments are passed on the stack, right to left. 2. int values and pointer values are returned in %eax. 3. floats are returned in %st(0). 4. when calling a function, %st(0) ~ %st(7) are all free. 5. functions are free to use %eax, %ecx, %edx, because caller needs to save them. 6. stack must be aligned to 4 bytes (before gcc 4.5, for gcc 4.5+, aligned to 16 bytes).
ExprStmt Expression Statement
FloatLiteral May be a float or double
ForStmt for (init; cond; loop) { body } cond must be scalar
FuncCall
FuncDef
GEqual Greater or Equal than
GotoStmt Goto Statement
Greater Greater than
IfElseStmt If-else Statement if (cond) { true_stmt } else { false_stmt }
IfStmt If Statement: if (cond) stmt; If cond is non-zero, stmt is executed. cond must be arithmetic or pointer type.
IntLiteral May be signed or unsigned C doesn't have char constant, only int constant
LEqual Less or Equal than
LShift Left Shift: takes in two integrals, returns an integer.
LShiftAssign LShiftAssign: a <<= b
LabeledStmt Labeled Statement
Less Less than
LogicalAnd Logical and: both operands need to be non-zero.
LogicalNot !expr: only takes scalar type. After semantic analysis, only the following 4 types are possible: 1) long 2) ulong 3) float 4) double Pointers are converted to ulongs.
LogicalOr Logical or: at least one of operands needs to be non-zero.
ModAssign ModAssign: a %= b
Modulo Modulo: only accepts integrals.
MultAssign MultAssign: a *= b
Multiply Multiplication: perform usual arithmetic conversion.
Negative -expr: only takes arithmetic type. After semantic analysis, only the following 4 types are possible: 1) long 2) ulong 3) float 4) double
NonBasicTypeSpec
NotEqual Not equal
ParamDecln Parameter Declaration. int foo(int arg0, int arg1); ~~~~~~~~ int foo(int, int); ~~~ The declarator can be completely omitted.
Positive
PostDecrement expr--: must be a scalar
PostIncrement expr++: must be integral, float or pointer. If expr is an array, it is converted to a pointer in semantic analysis.
PreDecrement --expr: must be a scalar
PreIncrement ++expr: must be a scalar
RShift Right Shift: takes in two integrals, returns an integer;
RShiftAssign RShiftAssign: a >>= b
Reference
ReturnStmt
SizeofExpr
SizeofType
SpecQualList specifier-qualifier-list : [ Type-specifier | Type-qualifier ]+
Stmt
StringLiteral String Literal
StructDecln struct-declaration : specifier-qualifier-list struct-declarator-list ';' struct-declarator-list : struct-declarator [ ',' struct-declarator ]* struct-declarator : declarator | [declarator]? ':' constant-expression
StructOrUnionSpec struct-or-union-specifier
Sub Subtraction There are three kinds of subtractions: 1. arithmetic - arithmetic 2. pointer - integral 3. pointer - pointer
SubAssign SubAssign: a -= b
SwitchStmt Switch Statement
TranslnUnit
TypeCast
TypeName Type-name : specifier-qualifier-list [abstract-declarator]?
TypeSpec Type-specifier : void --+ | char | | short | | int | | long +--> Basic Type specifier | float | | double | | signed | | unsigned --+ | struct-or-union-specifier | enum-specifier | typedef-name
TypedefName typedef-name : identifier
UnaryExprOperator
Variable
WhileStmt While Statement while (cond) { body } cond must be of scalar type
Xor Xor: returns an integer.
XorAssign XorAssign: a ^= b