BNF for C2J.jj

NON-TERMINALS

TranslationUnit ::= ( ExternalDeclaration )+
ExternalDeclaration ::= ( FunctionDefinition | Declaration )
FunctionDefinition ::= ( DeclarationSpecifiers )? Declarator ( DeclarationList )? CompoundStatement
Declaration ::= DeclarationSpecifiers ( InitDeclaratorList )? ";"
DeclarationList ::= ( Declaration )+
DeclarationSpecifiers ::= StorageClassSpecifier ( DeclarationSpecifiers )?
| TypeSpecifier ( DeclarationSpecifiers )?
| TypeQualifier ( DeclarationSpecifiers )?
StorageClassSpecifier ::= ( <AUTO> | <REGISTER> | <STATIC> | <EXTERN> | <TYPEDEF> )
TypeSpecifier ::= ( ( ( <VOID> | <CHAR> | <SHORT> | <INT> | <FLOAT> | <DOUBLE> | <UNSIGNED> | <SIGNED> | <LONG> ) | TypeSpecifierGL ) | StructOrUnionSpecifier | EnumSpecifier | TypedefName )
TypeSpecifierGL ::= ( <GLvoid> | <GLbyte> | <GLshort> | <GLint> | <GLsizei> | <GLfloat> | <GLclampf> | <GLdouble> | <GLclampd> | <GLubyte> | <GLboolean> | <GLushort> | <GLuint> | <GLenum> | <GLbitfield> | <GLUquadric> | <GLUnurbs> | <GLUtesselator> | <GLUtriangulator> )
TypeQualifier ::= ( <CONST> | <VOLATILE> )
StructOrUnionSpecifier ::= StructOrUnion ( ( <IDENTIFIER> )? "{" StructDeclarationList "}" | <IDENTIFIER> )
StructOrUnion ::= ( <STRUCT> | <UNION> )
StructDeclarationList ::= ( StructDeclaration )+
InitDeclaratorList ::= InitDeclarator ( "," InitDeclarator )*
InitDeclarator ::= Declarator ( "=" Initializer )?
StructDeclaration ::= SpecifierQualifierList StructDeclaratorList ";"
SpecifierQualifierList ::= TypeSpecifier ( SpecifierQualifierList )?
| TypeQualifier ( SpecifierQualifierList )?
StructDeclaratorList ::= StructDeclarator ( "," StructDeclarator )*
StructDeclarator ::= ( Declarator | ( Declarator )? ":" ConstantExpression )
EnumSpecifier ::= <ENUM> ( ( <IDENTIFIER> )? "{" EnumeratorList "}" | <IDENTIFIER> )
EnumeratorList ::= Enumerator ( "," Enumerator )*
Enumerator ::= <IDENTIFIER> ( "=" ConstantExpression )?
Declarator ::= ( Pointer )? DirectDeclarator
DirectDeclarator ::= ( <IDENTIFIER> | "(" Declarator ")" ) ( "[" ( ConstantExpression )? "]" | "(" ( ParameterTypeList )? ")" | "(" IdentifierList ")" )*
Pointer ::= "*" ( TypeQualifierList )? ( Pointer )?
TypeQualifierList ::= ( TypeQualifier )+
ParameterTypeList ::= ParameterList ( "," "..." )?
ParameterList ::= ParameterDeclaration ( "," ParameterDeclaration )*
ParameterDeclaration ::= DeclarationSpecifiers ( Declarator | ( AbstractDeclarator )? )
IdentifierList ::= <IDENTIFIER> ( "," <IDENTIFIER> )*
Initializer ::= ( AssignmentExpression | "{" InitializerList ( "," )? "}" )
InitializerList ::= Initializer ( "," Initializer )*
TypeName ::= SpecifierQualifierList ( AbstractDeclarator )?
AbstractDeclarator ::= ( Pointer | ( Pointer )? DirectAbstractDeclarator )
DirectAbstractDeclarator ::= ( "(" AbstractDeclarator ")" | "[" ( ConstantExpression )? "]" | "(" ( ParameterTypeList )? ")" ) ( "[" ( ConstantExpression )? "]" | "(" ( ParameterTypeList )? ")" )*
TypedefName ::= <IDENTIFIER>
Statement ::= ( LabeledStatement | ExpressionStatement | CompoundStatement | SelectionStatement | IterationStatement | JumpStatement )
LabeledStatement ::= ( <IDENTIFIER> ":" Statement | <CASE> ConstantExpression ":" Statement | <DFLT> ":" Statement )
ExpressionStatement ::= ( Expression )? ";"
CompoundStatement ::= "{" ( DeclarationList )? ( StatementList )? "}"
StatementList ::= ( Statement )+
SelectionStatement ::= ( <IF> "(" Expression ")" Statement ( <ELSE> Statement )? | <SWITCH> "(" Expression ")" Statement )
IterationStatement ::= ( <WHILE> "(" Expression ")" Statement | <DO> Statement <WHILE> "(" Expression ")" ";" | <FOR> "(" ( Expression )? ";" ( Expression )? ";" ( Expression )? ")" Statement )
JumpStatement ::= ( <GOTO> <IDENTIFIER> ";" | <CONTINUE> ";" | <BREAK> ";" | <RETURN> ( Expression )? ";" )
Expression ::= AssignmentExpression ( "," AssignmentExpression )*
AssignmentExpression ::= UnaryExpression AssignmentOperator AssignmentExpression
| ConditionalExpression
AssignmentOperator ::= ( "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | "&=" | "^=" | "|=" )
ConditionalExpression ::= LogicalORExpression ( "?" Expression ":" ConditionalExpression )?
ConstantExpression ::= ConditionalExpression
LogicalORExpression ::= LogicalANDExpression ( "||" LogicalORExpression )?
LogicalANDExpression ::= InclusiveORExpression ( "&&" LogicalANDExpression )?
InclusiveORExpression ::= ExclusiveORExpression ( "|" InclusiveORExpression )?
ExclusiveORExpression ::= ANDExpression ( "^" ExclusiveORExpression )?
ANDExpression ::= EqualityExpression ( "&" ANDExpression )?
EqualityExpression ::= RelationalExpression ( ( "==" | "!=" ) EqualityExpression )?
RelationalExpression ::= ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) RelationalExpression )?
ShiftExpression ::= AdditiveExpression ( ( "<<" | ">>" ) ShiftExpression )?
AdditiveExpression ::= MultiplicativeExpression ( ( "+" | "-" ) AdditiveExpression )?
MultiplicativeExpression ::= CastExpression ( ( "*" | "/" | "%" ) MultiplicativeExpression )?
CastExpression ::= ( "(" TypeName ")" CastExpression | UnaryExpression )
UnaryExpression ::= ( PostfixExpression | "++" UnaryExpression | "--" UnaryExpression | UnaryOperator CastExpression | <SIZEOF> ( UnaryExpression | "(" TypeName ")" ) )
UnaryOperator ::= ( "&" | "*" | "+" | "-" | "~" | "!" )
PostfixExpression ::= PrimaryExpression ( "[" Expression "]" | "(" ( ArgumentExpressionList )? ")" | "." <IDENTIFIER> | "->" <IDENTIFIER> | "++" | "--" )*
PrimaryExpression ::= ( <IDENTIFIER> | Constant | "(" Expression ")" )
ArgumentExpressionList ::= AssignmentExpression ( "," AssignmentExpression )*
Constant ::= <INTEGER_LITERAL>
| <FLOATING_POINT_LITERAL>
| <CHARACTER_LITERAL>
| <STRING_LITERAL>