Iterative Factorial
Input
long int iter_Fact(int number);
int main() {
int number;
long int fact;
printf( "Enter number to get factorial of: ");
scanf( "%d", &number );
fact = iter_Fact(number);
printf( "Factorial of %d is: %ld \n", number, fact);
return 0;
}
long int iter_Fact( int number) {
int i;
long int fact = 1;
if( i < 0){
return 1;
}
for( i = number; i > 0; i --) {
fact = fact*i;
}
return fact;
}
STDOUT
Without the extra flags, the tokens, productions, or symbol table will not be output to files. The STDOUT is the same regardless of the flags.
$ python3 bin/jstcc.py ../iterative_factorial.c -s4 -p3 -w1
Warning: FastBinaryTree not available, using Python version BinaryTree.
Warning: FastAVLTree not available, using Python version AVLTree.
Warning: FastRBTree not available, using Python version RBTree.
WARNING: Token 'ECONST' defined, but not used
WARNING: There is 1 unused token
Generating LALR tables
WARNING: 1 shift/reduce conflict
Token Output
TOKEN: LONG long
TOKEN: INT int
TOKEN: ID None iter_Fact
TOKEN: LPAREN (
TOKEN: INT int
TOKEN: ID None number
TOKEN: RPAREN )
TOKEN: SEMI ;
SOURCE:
long int iter_Fact( int number);
-----
TOKEN: INT int
TOKEN: ID None main
TOKEN: LPAREN (
TOKEN: RPAREN )
TOKEN: LBRACE {
SOURCE:
int main() {
-----
TOKEN: INT int
TOKEN: ID int number
TOKEN: SEMI ;
SOURCE:
int number;
-----
TOKEN: LONG long
TOKEN: INT int
TOKEN: ID None fact
TOKEN: SEMI ;
SOURCE:
long int fact;
-----
TOKEN: ID None printf
TOKEN: LPAREN (
TOKEN: SCONST "Enter number to get factorial of: "
TOKEN: RPAREN )
TOKEN: SEMI ;
SOURCE:
printf( "Enter number to get factorial of: ");
-----
TOKEN: ID None scanf
TOKEN: LPAREN (
TOKEN: SCONST "%d"
TOKEN: COMMA ,
TOKEN: AND &
TOKEN: ID int number
TOKEN: RPAREN )
TOKEN: SEMI ;
SOURCE:
scanf( "%d", &number );
-----
TOKEN: ID int long fact
TOKEN: EQUALS =
TOKEN: ID int long iter_Fact(int number)
TOKEN: LPAREN (
TOKEN: ID int number
TOKEN: RPAREN )
TOKEN: SEMI ;
SOURCE:
fact = iter_Fact(number);
-----
TOKEN: ID None printf
TOKEN: LPAREN (
TOKEN: SCONST "Factorial of %d is: %ld \n"
TOKEN: COMMA ,
TOKEN: ID int number
TOKEN: COMMA ,
TOKEN: ID int long fact
TOKEN: RPAREN )
TOKEN: SEMI ;
SOURCE:
printf( "Factorial of %d is: %ld \n", number, fact);
-----
TOKEN: RETURN return
TOKEN: ICONST 0
TOKEN: SEMI ;
SOURCE:
return 0;
-----
TOKEN: RBRACE }
SOURCE:
}
-----
TOKEN: LONG long
TOKEN: INT int
TOKEN: ID int long iter_Fact(int number)
TOKEN: LPAREN (
TOKEN: INT int
TOKEN: ID int number
TOKEN: RPAREN )
TOKEN: LBRACE {
SOURCE:
long int iter_Fact( int number) {
-----
TOKEN: INT int
TOKEN: ID None i
TOKEN: SEMI ;
SOURCE:
int i;
-----
TOKEN: LONG long
TOKEN: INT int
TOKEN: ID None fact
TOKEN: EQUALS =
TOKEN: ICONST 1
TOKEN: SEMI ;
SOURCE:
long int fact = 1;
-----
TOKEN: IF if
TOKEN: LPAREN (
TOKEN: ID int i
TOKEN: LT <
TOKEN: ICONST 0
TOKEN: RPAREN )
TOKEN: LBRACE {
SOURCE:
if( i < 0){
-----
TOKEN: RETURN return
TOKEN: ICONST 1
TOKEN: SEMI ;
SOURCE:
return 1;
-----
TOKEN: RBRACE }
SOURCE:
}
-----
TOKEN: FOR for
TOKEN: LPAREN (
TOKEN: ID int i
TOKEN: EQUALS =
TOKEN: ID int number
TOKEN: SEMI ;
TOKEN: ID int i
TOKEN: GT >
TOKEN: ICONST 0
TOKEN: SEMI ;
TOKEN: ID int i
TOKEN: MINUSMINUS --
TOKEN: RPAREN )
TOKEN: LBRACE {
SOURCE:
for( i = number; i > 0; i --) {
-----
TOKEN: ID int long fact
TOKEN: EQUALS =
TOKEN: ID int long fact
TOKEN: TIMES *
TOKEN: ID int i
TOKEN: SEMI ;
SOURCE:
fact = fact*i;
-----
TOKEN: RBRACE }
SOURCE:
}
-----
TOKEN: RETURN return
TOKEN: ID int long fact
TOKEN: SEMI ;
SOURCE:
return fact;
-----
TOKEN: RBRACE }
SOURCE:
}
-----
Production Output
PRODUCTION: type_specifier -> LONG
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: declaration_specifiers -> type_specifier declaration_specifiers
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: declarator -> direct_declarator
PRODUCTION: parameter_declaration : declaration_specifiers declarator
PRODUCTION: parameter_list : parameter_declaration
PRODUCTION: parameter_type_list : parameter_list
PRODUCTION: direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN
PRODUCTION: declarator -> direct_declarator
PRODUCTION: init_declarator -> declarator
PRODUCTION: init_declarator_list -> init_declarator
PRODUCTION: declaration -> declaration_specifiers init_declarator_list SEMI
PRODUCTION: external_declaration -> declaration
PRODUCTION: translation_unit_1 -> external_declaration
PRODUCTION: translation_unit -> translation_unit_opt
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: direct_declarator : direct_declarator LPAREN RPAREN
PRODUCTION: declarator -> direct_declarator
INFO: Entering new scope
INFO: Entering insert mode.
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: declarator -> direct_declarator
PRODUCTION: init_declarator -> declarator
PRODUCTION: init_declarator_list -> init_declarator
PRODUCTION: declaration -> declaration_specifiers init_declarator_list SEMI
PRODUCTION: declaration_list -> declaration
PRODUCTION: type_specifier -> LONG
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: declaration_specifiers -> type_specifier declaration_specifiers
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: declarator -> direct_declarator
PRODUCTION: init_declarator -> declarator
PRODUCTION: init_declarator_list -> init_declarator
PRODUCTION: declaration -> declaration_specifiers init_declarator_list SEMI
PRODUCTION: declaration_list -> declaration_list declaration
INFO: Entering lookup mode.
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: string_literal_list -> SCONST
PRODUCTION: primary_expression -> string_literal_list
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> assignment_expression
PRODUCTION: postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: expression_statement : expression_option SEMI
PRODUCTION: statement -> expression_statment
PRODUCTION: statement_list : statement
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: string_literal_list -> SCONST
PRODUCTION: primary_expression -> string_literal_list
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> assignment_expression
PRODUCTION: unary_operator -> AND
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: unary_expression -> unary_operator cast_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> argument_expression_list COMMA assignment_expression
PRODUCTION: postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: expression_statement : expression_option SEMI
PRODUCTION: statement -> expression_statment
PRODUCTION: statement_list : statement_list statement
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: assignment_operator -> EQUALS
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> assignment_expression
PRODUCTION: postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: assignment_expression : unary_expression assignment_operator assignment_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: expression_statement : expression_option SEMI
PRODUCTION: statement -> expression_statment
PRODUCTION: statement_list : statement_list statement
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: string_literal_list -> SCONST
PRODUCTION: primary_expression -> string_literal_list
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> assignment_expression
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> argument_expression_list COMMA assignment_expression
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: argument_expression_list -> argument_expression_list COMMA assignment_expression
PRODUCTION: postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: expression_statement : expression_option SEMI
PRODUCTION: statement -> expression_statment
PRODUCTION: statement_list : statement_list statement
PRODUCTION: constant -> ICONST
PRODUCTION: primary_expression -> constant
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: jump_statement : RETURN expression_option SEMI
PRODUCTION: statement -> jump_statement
PRODUCTION: statement_list : statement_list statement
INFO: Leaving a scope: 2
PRODUCTION: compound_statement : LBRACE declaration_list statement_list RBRACE
PRODUCTION: function_definition -> declaration_specifiers declarator compound_statement
PRODUCTION: external_declaration -> function_definition
PRODUCTION: translation_unit_2 -> translation_unit external_declaration
PRODUCTION: translation_unit -> translation_unit_opt
PRODUCTION: type_specifier -> LONG
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: declaration_specifiers -> type_specifier declaration_specifiers
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: declarator -> direct_declarator
PRODUCTION: parameter_declaration : declaration_specifiers declarator
PRODUCTION: parameter_list : parameter_declaration
PRODUCTION: parameter_type_list : parameter_list
PRODUCTION: direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN
PRODUCTION: declarator -> direct_declarator
INFO: Entering new scope
INFO: Entering insert mode.
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: declarator -> direct_declarator
PRODUCTION: init_declarator -> declarator
PRODUCTION: init_declarator_list -> init_declarator
PRODUCTION: declaration -> declaration_specifiers init_declarator_list SEMI
PRODUCTION: declaration_list -> declaration
PRODUCTION: type_specifier -> LONG
PRODUCTION: type_specifier -> INT
PRODUCTION: declaration_specifiers -> type_specifier
PRODUCTION: declaration_specifiers -> type_specifier declaration_specifiers
PRODUCTION: identifier -> ID
PRODUCTION: direct_declarator -> identifier
PRODUCTION: declarator -> direct_declarator
PRODUCTION: constant -> ICONST
PRODUCTION: primary_expression -> constant
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: initializer : assignment_expression
PRODUCTION: init_declarator : declarator EQUALS initializer
PRODUCTION: init_declarator_list -> init_declarator
PRODUCTION: declaration -> declaration_specifiers init_declarator_list SEMI
PRODUCTION: declaration_list -> declaration_list declaration
INFO: Entering lookup mode.
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: constant -> ICONST
PRODUCTION: primary_expression -> constant
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> relational_expression LT shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
INFO: Entering new scope
INFO: Entering lookup mode.
PRODUCTION: constant -> ICONST
PRODUCTION: primary_expression -> constant
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: jump_statement : RETURN expression_option SEMI
PRODUCTION: statement -> jump_statement
PRODUCTION: statement_list : statement
INFO: Leaving a scope: 3
PRODUCTION: compound_statement : LBRACE statement_list RBRACE
PRODUCTION: statement -> compound_statement
PRODUCTION: selection_statement : IF LPAREN expression RPAREN statement
PRODUCTION: statement ->selection_statement
PRODUCTION: statement_list : statement
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: assignment_operator -> EQUALS
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: assignment_expression : unary_expression assignment_operator assignment_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: constant -> ICONST
PRODUCTION: primary_expression -> constant
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression : relational_expression GT shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: postfix_expression -> postfix_expression MINUSMINUS
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
INFO: Entering new scope
INFO: Entering lookup mode.
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: assignment_operator -> EQUALS
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> multiplicative_expression TIMES cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: assignment_expression : unary_expression assignment_operator assignment_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: expression_statement : expression_option SEMI
PRODUCTION: statement -> expression_statment
PRODUCTION: statement_list : statement
INFO: Leaving a scope: 3
PRODUCTION: compound_statement : LBRACE statement_list RBRACE
PRODUCTION: statement -> compound_statement
PRODUCTION: iteration_statement -> FOR LPAREN expression_option SEMI expression_option SEMI expression_option RPAREN statement
PRODUCTION: statement ->iteration_statement
PRODUCTION: statement_list : statement_list statement
PRODUCTION: identifier -> ID
PRODUCTION: primary_expression -> identifier
PRODUCTION: postfix_expression -> primary_expression
PRODUCTION: unary_expression -> postfix_expression
PRODUCTION: cast_expression -> unary_expression
PRODUCTION: multiplicative_expression -> cast_expression
PRODUCTION: additive_expression -> multiplicative_expression
PRODUCTION: shift_expression -> additive_expression
PRODUCTION: relational_expression -> shift_expression
PRODUCTION: equality_expression -> relational_expression
PRODUCTION: and_expression -> equality_expression
PRODUCTION: exclusive_or_expression -> and_expression
PRODUCTION: inclusive_or_expression -> exclusive_or_expression
PRODUCTION: logical_and_expression -> inclusive_or_expression
PRODUCTION: logical_or_expression -> logical_and_expression
PRODUCTION: conditional_expression -> logical_or_expression
PRODUCTION: assignment_expression : conditional_expression
PRODUCTION: expression : assignment_expression
PRODUCTION: expression_option -> expression
PRODUCTION: jump_statement : RETURN expression_option SEMI
PRODUCTION: statement -> jump_statement
PRODUCTION: statement_list : statement_list statement
INFO: Leaving a scope: 2
PRODUCTION: compound_statement : LBRACE declaration_list statement_list RBRACE
PRODUCTION: function_definition -> declaration_specifiers declarator compound_statement
PRODUCTION: external_declaration -> function_definition
PRODUCTION: translation_unit_2 -> translation_unit external_declaration
PRODUCTION: translation_unit -> translation_unit_opt
Symbol Table Output
SYMBOL TABLE: Opening brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number)
main : None main
number : int number
SYMBOL TABLE:
SYMBOL TABLE: Closing brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number)
main : None main()
number : int number
1
fact : int long fact
printf : None printf
scanf : None scanf
SYMBOL TABLE:
SYMBOL TABLE: Opening brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number)
main : int main()
number : int number
SYMBOL TABLE:
SYMBOL TABLE: Opening brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number, int number)
main : int main()
number : int number
1
fact : int long fact
i : int i
SYMBOL TABLE:
SYMBOL TABLE: Closing brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number, int number)
main : int main()
number : int number
1
fact : int long fact
i : int i
2
SYMBOL TABLE:
SYMBOL TABLE: Opening brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number, int number)
main : int main()
number : int number
1
fact : int long fact
i : int i
SYMBOL TABLE:
SYMBOL TABLE: Closing brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number, int number)
main : int main()
number : int number
1
fact : int long fact
i : int i
2
SYMBOL TABLE:
SYMBOL TABLE: Closing brace encountered, symbol table dumped:
SYMBOL TABLE:
0
iter_Fact : int long iter_Fact(int number, int number)
main : int main()
number : int number
1
fact : int long fact
i : int i
SYMBOL TABLE: