[agm_grammar3.xml] Found 16 Production Rules
Our Grammar is:

Terminal Tokens: (11)

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

Non-Terminal Tokens: (8)

   START  type:NONTERMINAL
   expression  type:NONTERMINAL
   expression_tail  type:NONTERMINAL
   factor  type:NONTERMINAL
   factor_tail  type:NONTERMINAL
   primary  type:NONTERMINAL
   term  type:NONTERMINAL
   term_tail  type:NONTERMINAL

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



FirstSets

First[START] :=    (   identifier   integer_literal

First[SYSGOAL] :=    (   identifier   integer_literal

First[expression] :=    (   identifier   integer_literal

First[expression_tail] :=    +   -   lambda

First[factor] :=    (   identifier   integer_literal

First[factor_tail] :=    ^   lambda

First[primary] :=    (   identifier   integer_literal

First[term] :=    (   identifier   integer_literal

First[term_tail] :=    *   /   lambda

FollowSets

Follow[START] :=    $

Follow[expression] :=    $   )

Follow[expression_tail] :=    $   )

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

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

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

Follow[term] :=    $   )   +   -

Follow[term_tail] :=    $   )   +   -

THIS GRAMMAR IS LL1

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



CFSM

State 0
  SYSGOAL  -->    START   $   2
  START  -->    expression   3
  expression  -->    term   expression_tail   8
  term  -->    factor   term_tail   4
  factor  -->    primary   factor_tail   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 2
  SYSGOAL  -->  START     $   9


State 9
  SYSGOAL  -->  START   $    


State 7
  factor  -->  primary     factor_tail   11
  factor_tail  -->    ^   primary   factor_tail   10
  factor_tail  -->  lambda    


State 11
  factor  -->  primary   factor_tail    


State 12
  factor_tail  -->    ^   primary   factor_tail   10
  factor_tail  -->  ^   primary     factor_tail   24
  factor_tail  -->  lambda    


State 10
  factor_tail  -->  ^     primary   factor_tail   12
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 24
  factor_tail  -->  ^   primary   factor_tail    


State 5
  primary  -->  identifier    


State 6
  primary  -->  integer_literal    


State 13
  primary  -->  (   expression     )   25


State 25
  primary  -->  (   expression   )    


State 3
  START  -->  expression    


State 1
  expression  -->    term   expression_tail   8
  term  -->    factor   term_tail   4
  factor  -->    primary   factor_tail   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1
  primary  -->  (     expression   )   13


State 8
  expression  -->  term     expression_tail   16
  expression_tail  -->    +   term   expression_tail   14
  expression_tail  -->    -   term   expression_tail   15
  expression_tail  -->  lambda    


State 16
  expression  -->  term   expression_tail    


State 17
  expression_tail  -->    +   term   expression_tail   14
  expression_tail  -->  +   term     expression_tail   26
  expression_tail  -->    -   term   expression_tail   15
  expression_tail  -->  lambda    


State 18
  expression_tail  -->    +   term   expression_tail   14
  expression_tail  -->    -   term   expression_tail   15
  expression_tail  -->  -   term     expression_tail   27
  expression_tail  -->  lambda    


State 14
  expression_tail  -->  +     term   expression_tail   17
  term  -->    factor   term_tail   4
  factor  -->    primary   factor_tail   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 26
  expression_tail  -->  +   term   expression_tail    


State 15
  expression_tail  -->  -     term   expression_tail   18
  term  -->    factor   term_tail   4
  factor  -->    primary   factor_tail   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 27
  expression_tail  -->  -   term   expression_tail    


State 4
  term  -->  factor     term_tail   21
  term_tail  -->    *   factor   term_tail   19
  term_tail  -->    /   factor   term_tail   20
  term_tail  -->  lambda    


State 21
  term  -->  factor   term_tail    


State 22
  term_tail  -->    *   factor   term_tail   19
  term_tail  -->  *   factor     term_tail   28
  term_tail  -->    /   factor   term_tail   20
  term_tail  -->  lambda    


State 23
  term_tail  -->    *   factor   term_tail   19
  term_tail  -->    /   factor   term_tail   20
  term_tail  -->  /   factor     term_tail   29
  term_tail  -->  lambda    


State 19
  term_tail  -->  *     factor   term_tail   22
  factor  -->    primary   factor_tail   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 28
  term_tail  -->  *   factor   term_tail    


State 20
  term_tail  -->  /     factor   term_tail   23
  factor  -->    primary   factor_tail   7
  primary  -->    identifier   5
  primary  -->    integer_literal   6
  primary  -->    (   expression   )   1


State 29
  term_tail  -->  /   factor   term_tail    




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 $ RED-10
11 ) RED-10
11 * RED-10
11 + RED-10
11 - RED-10
11 / RED-10
12 $ RED-12
12 ) RED-12
12 * RED-12
12 + RED-12
12 - RED-12
12 / RED-12
12 ^ SHFT-10
13 ) SHFT-25
14 ( SHFT-1
14 identifier SHFT-5
14 integer_literal SHFT-6
15 ( SHFT-1
15 identifier SHFT-5
15 integer_literal SHFT-6
16 $ RED-2
16 ) RED-2
17 $ RED-5
17 ) RED-5
17 + SHFT-14
17 - SHFT-15
18 $ RED-5
18 ) RED-5
18 + SHFT-14
18 - SHFT-15
19 ( SHFT-1
19 identifier SHFT-5
19 integer_literal SHFT-6
2 $ SHFT-9
20 ( SHFT-1
20 identifier SHFT-5
20 integer_literal SHFT-6
21 $ RED-6
21 ) RED-6
21 + RED-6
21 - RED-6
22 $ RED-9
22 ) RED-9
22 * SHFT-19
22 + RED-9
22 - RED-9
22 / SHFT-20
23 $ RED-9
23 ) RED-9
23 * SHFT-19
23 + RED-9
23 - RED-9
23 / SHFT-20
24 $ RED-11
24 ) RED-11
24 * RED-11
24 + RED-11
24 - RED-11
24 / RED-11
25 $ RED-15
25 ) RED-15
25 * RED-15
25 + RED-15
25 - RED-15
25 / RED-15
25 ^ RED-15
26 $ RED-3
26 ) RED-3
27 $ RED-4
27 ) RED-4
28 $ RED-7
28 ) RED-7
28 + RED-7
28 - RED-7
29 $ RED-8
29 ) RED-8
29 + RED-8
29 - RED-8
3 $ RED-1
4 $ RED-9
4 ) RED-9
4 * SHFT-19
4 + RED-9
4 - RED-9
4 / SHFT-20
5 $ RED-13
5 ) RED-13
5 * RED-13
5 + RED-13
5 - RED-13
5 / RED-13
5 ^ RED-13
6 $ RED-14
6 ) RED-14
6 * RED-14
6 + RED-14
6 - RED-14
6 / RED-14
6 ^ RED-14
7 $ RED-12
7 ) RED-12
7 * RED-12
7 + RED-12
7 - RED-12
7 / RED-12
7 ^ SHFT-10
8 $ RED-5
8 ) RED-5
8 + SHFT-14
8 - SHFT-15
9 $ ACCEPT

Expression Parser


INPUT: integer_literal + integer_literal $

Shifted +
Reduced with Rule 14
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 6
Shifted integer_literal
Shifted $
Reduced with Rule 14
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 6
Reduced with Rule 5
Reduced with Rule 3
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 14
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 6
Shifted integer_literal
Shifted )
Reduced with Rule 14
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 6
Reduced with Rule 5
Reduced with Rule 3
Reduced with Rule 2
Shifted *
Reduced with Rule 15
Reduced with Rule 12
Reduced with Rule 10
Shifted identifier
Shifted $
Reduced with Rule 13
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 6
Reduced with Rule 5
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 14
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 6
Shifted integer_literal
Shifted )
Reduced with Rule 14
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 6
Reduced with Rule 5
Reduced with Rule 3
Reduced with Rule 2
Shifted *
Reduced with Rule 15
Reduced with Rule 12
Reduced with Rule 10
Shifted identifier
Shifted )
Reduced with Rule 13
Reduced with Rule 12
Reduced with Rule 10
Reduced with Rule 9
Reduced with Rule 7
Reduced with Rule 6
Reduced with Rule 5
Reduced with Rule 2
PARSE ERROR!