[agm_grammar2.xml] Found 13 Production Rules
Our Grammar is:

Terminal Tokens: (10)

   $  type:TERMINAL
   (  type:TERMINAL
   )  type:TERMINAL
   *  type:TERMINAL
   +  type:TERMINAL
   -  type:TERMINAL
   /  type:TERMINAL
   ^  type:TERMINAL
   identifier  type:TERMINAL
   integer_literal  type:TERMINAL

Non-Terminal Tokens: (5)

   START  type:NONTERMINAL
   expression  type:NONTERMINAL
   factor  type:NONTERMINAL
   primary  type:NONTERMINAL
   term  type:NONTERMINAL

Production Rules:
1: START  -->  expression  
0: SYSGOAL  -->  START   $  
2: expression  -->  expression   +   term  
3: expression  -->  expression   -   term  
4: expression  -->  term  
8: factor  -->  factor   ^   primary  
9: factor  -->  primary  
10: primary  -->  identifier  
11: primary  -->  integer_literal  
12: primary  -->  (   expression   )  
5: term  -->  term   *   factor  
6: term  -->  term   /   factor  
7: term  -->  factor  



FirstSets

First[START] :=    (   identifier   integer_literal

First[SYSGOAL] :=    (   identifier   integer_literal

First[expression] :=    (   identifier   integer_literal

First[factor] :=    (   identifier   integer_literal

First[primary] :=    (   identifier   integer_literal

First[term] :=    (   identifier   integer_literal

FollowSets

Follow[START] :=    $

Follow[expression] :=    $   )   +   -

Follow[factor] :=    $   )   *   +   -   /   ^

Follow[primary] :=    $   )   *   +   -   /   ^

Follow[term] :=    $   )   *   +   -   /

THIS GRAMMAR IS NOT LL1

Parse Table:
CurrentLookAheadApply Rule
START(START --> expression 
STARTidentifierSTART --> expression 
STARTinteger_literalSTART --> expression 
SYSGOAL(SYSGOAL --> START $ 
SYSGOALidentifierSYSGOAL --> START $ 
SYSGOALinteger_literalSYSGOAL --> START $ 
expression(expression --> expression + term 
expression(expression --> expression - term 
expression(expression --> term 
expressionidentifierexpression --> expression + term 
expressionidentifierexpression --> expression - term 
expressionidentifierexpression --> term 
expressioninteger_literalexpression --> expression + term 
expressioninteger_literalexpression --> expression - term 
expressioninteger_literalexpression --> term 
factor(factor --> factor ^ primary 
factor(factor --> primary 
factoridentifierfactor --> factor ^ primary 
factoridentifierfactor --> primary 
factorinteger_literalfactor --> factor ^ primary 
factorinteger_literalfactor --> primary 
primary(primary --> ( expression ) 
primaryidentifierprimary --> identifier 
primaryinteger_literalprimary --> integer_literal 
term(term --> term * factor 
term(term --> term / factor 
term(term --> factor 
termidentifierterm --> term * factor 
termidentifierterm --> term / factor 
termidentifierterm --> factor 
terminteger_literalterm --> term * factor 
terminteger_literalterm --> term / factor 
terminteger_literalterm --> factor 



CFSM

State 0
  SYSGOAL  -->    START   $   2
  START  -->    expression   3
  expression  -->    expression   +   term   3
  expression  -->    expression   -   term   3
  expression  -->    term   8
  term  -->    term   *   factor   8
  term  -->    term   /   factor   8
  term  -->    factor   4
  factor  -->    factor   ^   primary   4
  factor  -->    primary   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 2
  SYSGOAL  -->  START     $   9


State 9
  SYSGOAL  -->  START   $    


State 5
  primary  -->  identifier    


State 6
  primary  -->  integer_literal    


State 13
  primary  -->  (   expression   )    


State 3
  START  -->  expression    
  expression  -->  expression     +   term   10
  expression  -->  expression     -   term   11


State 1
  expression  -->    expression   +   term   12
  expression  -->    expression   -   term   12
  expression  -->    term   8
  term  -->    term   *   factor   8
  term  -->    term   /   factor   8
  term  -->    factor   4
  factor  -->    factor   ^   primary   4
  factor  -->    primary   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1
  primary  -->  (     expression   )   12


State 12
  expression  -->  expression     +   term   10
  expression  -->  expression     -   term   11
  primary  -->  (   expression     )   13


State 10
  expression  -->  expression   +     term   14
  term  -->    term   *   factor   14
  term  -->    term   /   factor   14
  term  -->    factor   4
  factor  -->    factor   ^   primary   4
  factor  -->    primary   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 14
  expression  -->  expression   +   term    
  term  -->  term     *   factor   15
  term  -->  term     /   factor   16


State 11
  expression  -->  expression   -     term   17
  term  -->    term   *   factor   17
  term  -->    term   /   factor   17
  term  -->    factor   4
  factor  -->    factor   ^   primary   4
  factor  -->    primary   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 17
  expression  -->  expression   -   term    
  term  -->  term     *   factor   15
  term  -->  term     /   factor   16


State 8
  expression  -->  term    
  term  -->  term     *   factor   15
  term  -->  term     /   factor   16


State 15
  term  -->  term   *     factor   18
  factor  -->    factor   ^   primary   18
  factor  -->    primary   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 18
  term  -->  term   *   factor    
  factor  -->  factor     ^   primary   19


State 16
  term  -->  term   /     factor   20
  factor  -->    factor   ^   primary   20
  factor  -->    primary   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 20
  term  -->  term   /   factor    
  factor  -->  factor     ^   primary   19


State 4
  term  -->  factor    
  factor  -->  factor     ^   primary   19


State 19
  factor  -->  factor   ^     primary   21
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 21
  factor  -->  factor   ^   primary    


State 7
  factor  -->  primary    




State    Lookahead Action
0 ( SHFT-1
0 identifier SHFT-5
0 integer_literal SHFT-6
1 ( SHFT-1
1 identifier SHFT-5
1 integer_literal SHFT-6
10 ( SHFT-1
10 identifier SHFT-5
10 integer_literal SHFT-6
11 ( SHFT-1
11 identifier SHFT-5
11 integer_literal SHFT-6
12 ) SHFT-13
12 + SHFT-10
12 - SHFT-11
13 $ RED-12
13 ) RED-12
13 * RED-12
13 + RED-12
13 - RED-12
13 / RED-12
13 ^ RED-12
14 $ RED-2
14 ) RED-2
14 * SHFT-15
14 + RED-2
14 - RED-2
14 / SHFT-16
15 ( SHFT-1
15 identifier SHFT-5
15 integer_literal SHFT-6
16 ( SHFT-1
16 identifier SHFT-5
16 integer_literal SHFT-6
17 $ RED-3
17 ) RED-3
17 * SHFT-15
17 + RED-3
17 - RED-3
17 / SHFT-16
18 $ RED-5
18 ) RED-5
18 * RED-5
18 + RED-5
18 - RED-5
18 / RED-5
18 ^ SHFT-19
19 ( SHFT-1
19 identifier SHFT-5
19 integer_literal SHFT-6
2 $ SHFT-9
20 $ RED-6
20 ) RED-6
20 * RED-6
20 + RED-6
20 - RED-6
20 / RED-6
20 ^ SHFT-19
21 $ RED-8
21 ) RED-8
21 * RED-8
21 + RED-8
21 - RED-8
21 / RED-8
21 ^ RED-8
3 $ RED-1
3 + SHFT-10
3 - SHFT-11
4 $ RED-7
4 ) RED-7
4 * RED-7
4 + RED-7
4 - RED-7
4 / RED-7
4 ^ SHFT-19
5 $ RED-10
5 ) RED-10
5 * RED-10
5 + RED-10
5 - RED-10
5 / RED-10
5 ^ RED-10
6 $ RED-11
6 ) RED-11
6 * RED-11
6 + RED-11
6 - RED-11
6 / RED-11
6 ^ RED-11
7 $ RED-9
7 ) RED-9
7 * RED-9
7 + RED-9
7 - RED-9
7 / RED-9
7 ^ RED-9
8 $ RED-4
8 ) RED-4
8 * SHFT-15
8 + RED-4
8 - RED-4
8 / SHFT-16
9 $ ACCEPT

Expression Parser


INPUT: integer_literal + integer_literal $

Shifted +
Reduced with Rule 11
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 4
Shifted integer_literal
Shifted $
Reduced with Rule 11
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 2
Reduced with Rule 1
Shifted $
ACCEPT!

Expression Parser


INPUT: ( integer_literal + integer_literal ) * identifier $

Shifted integer_literal
Shifted +
Reduced with Rule 11
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 4
Shifted integer_literal
Shifted )
Reduced with Rule 11
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 2
Shifted *
Reduced with Rule 12
Reduced with Rule 9
Reduced with Rule 7
Shifted identifier
Shifted $
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 1
Shifted $
ACCEPT!

Expression Parser


INPUT: ( integer_literal + integer_literal ) * identifier ) $

Shifted integer_literal
Shifted +
Reduced with Rule 11
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 4
Shifted integer_literal
Shifted )
Reduced with Rule 11
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 2
Shifted *
Reduced with Rule 12
Reduced with Rule 9
Reduced with Rule 7
Shifted identifier
Shifted )
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 5
Reduced with Rule 4
PARSE ERROR!