[agm_fischer_leblanc_g3.xml] Found 7 Production Rules
Our Grammar is:

Terminal Tokens: (6)

   $  type:TERMINAL
   (  type:TERMINAL
   )  type:TERMINAL
   *  type:TERMINAL
   +  type:TERMINAL
   identifier  type:TERMINAL

Non-Terminal Tokens: (3)

   expression  type:NONTERMINAL
   primary  type:NONTERMINAL
   term  type:NONTERMINAL

Production Rules:
0: SYSGOAL  -->  expression   $  
1: expression  -->  expression   +   term  
2: expression  -->  term  
5: primary  -->  identifier  
6: primary  -->  (   expression   )  
3: term  -->  term   *   primary  
4: term  -->  primary  



FirstSets

First[SYSGOAL] :=    (   identifier

First[expression] :=    (   identifier

First[primary] :=    (   identifier

First[term] :=    (   identifier

FollowSets

Follow[expression] :=    $   )   +

Follow[primary] :=    $   )   *   +

Follow[term] :=    $   )   *   +

THIS GRAMMAR IS NOT LL1

Parse Table:
CurrentLookAheadApply Rule
SYSGOAL(SYSGOAL --> expression $ 
SYSGOALidentifierSYSGOAL --> expression $ 
expression(expression --> expression + term 
expression(expression --> term 
expressionidentifierexpression --> expression + term 
expressionidentifierexpression --> term 
primary(primary --> ( expression ) 
primaryidentifierprimary --> identifier 
term(term --> term * primary 
term(term --> primary 
termidentifierterm --> term * primary 
termidentifierterm --> primary 



CFSM

State 0
  SYSGOAL  -->    expression   $   2
  expression  -->    expression   +   term   2
  expression  -->    term   5
  term  -->    term   *   primary   5
  term  -->    primary   4
  primary  -->    identifier   3
  primary  -->    (   expression   )   1


State 2
  SYSGOAL  -->  expression     $   6
  expression  -->  expression     +   term   7


State 6
  SYSGOAL  -->  expression   $    


State 1
  expression  -->    expression   +   term   8
  expression  -->    term   5
  term  -->    term   *   primary   5
  term  -->    primary   4
  primary  -->    identifier   3
  primary  -->    (   expression   )   1
  primary  -->  (     expression   )   8


State 8
  expression  -->  expression     +   term   7
  primary  -->  (   expression     )   9


State 7
  expression  -->  expression   +     term   10
  term  -->    term   *   primary   10
  term  -->    primary   4
  primary  -->    identifier   3
  primary  -->    (   expression   )   1


State 10
  expression  -->  expression   +   term    
  term  -->  term     *   primary   11


State 5
  expression  -->  term    
  term  -->  term     *   primary   11


State 11
  term  -->  term   *     primary   12
  primary  -->    identifier   3
  primary  -->    (   expression   )   1


State 12
  term  -->  term   *   primary    


State 4
  term  -->  primary    


State 3
  primary  -->  identifier    


State 9
  primary  -->  (   expression   )    




State    Lookahead Action
0 ( SHFT-1
0 identifier SHFT-3
1 ( SHFT-1
1 identifier SHFT-3
10 $ RED-1
10 ) RED-1
10 * SHFT-11
10 + RED-1
11 ( SHFT-1
11 identifier SHFT-3
12 $ RED-3
12 ) RED-3
12 * RED-3
12 + RED-3
2 $ SHFT-6
2 + SHFT-7
3 $ RED-5
3 ) RED-5
3 * RED-5
3 + RED-5
4 $ RED-4
4 ) RED-4
4 * RED-4
4 + RED-4
5 $ RED-2
5 ) RED-2
5 * SHFT-11
5 + RED-2
6 $ ACCEPT
7 ( SHFT-1
7 identifier SHFT-3
8 ) SHFT-9
8 + SHFT-7
9 $ RED-6
9 ) RED-6
9 * RED-6
9 + RED-6

Expression Parser


INPUT: identifier + identifier $

Shifted +
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 2
Shifted identifier
Shifted $
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 1
Shifted $
ACCEPT!

Expression Parser


INPUT: ( identifier + identifier ) * identifier $

Shifted identifier
Shifted +
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 2
Shifted identifier
Shifted )
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 1
Shifted *
Reduced with Rule 6
Reduced with Rule 4
Shifted identifier
Shifted $
Reduced with Rule 5
Reduced with Rule 3
Reduced with Rule 2
Shifted $
ACCEPT!

Expression Parser


INPUT: ( identifier + identifier ) * identifier ) $

Shifted identifier
Shifted +
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 2
Shifted identifier
Shifted )
Reduced with Rule 5
Reduced with Rule 4
Reduced with Rule 1
Shifted *
Reduced with Rule 6
Reduced with Rule 4
Shifted identifier
Shifted )
Reduced with Rule 5
Reduced with Rule 3
Reduced with Rule 2
PARSE ERROR!