This is the current LL(1) grammar that the parse is suitable for:Exp -> Int Oper

Oper -> * Exp |

/ Exp |

+ Exp |

- Exp |

epsilon

Int -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9## First and Follow Functions

First:

- First(Exp) -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
- First(Oper) -> * | / | + | - | epsilon
- First(Int) -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

- Follow(Exp) -> $
- Follow(Oper) -> $
- Follow(Int) -> * | / | + | - | $

* | / | + | - | 0 | 1 | . . . | 9 | $ | |

Exp | N/A | N/A | N/A | N/A | Exp -> Int Oper | Exp -> Int Oper | . . . | Exp -> Int Oper | N/A |

Oper | Oper -> * Int Oper | Oper -> / Int Oper | Oper -> + Int Oper | Oper -> - Int Oper | N/A | N/A | . . . | N/A | Oper -> epsilon |

Int | N/A | N/A | N/A | N/A | Int -> 0 | Int -> 1 | . . . | Int -> 9 | N/A |

This is how a current nonterminal symbol found in an expression will be derived based on the next terminal (lookahead).

Non terminal | Lookahead | Derivation |
---|---|---|

EXP | 0 | EXP -> INT OPER |

EXP | 1 | EXP -> INT OPER |

EXP | 2 | EXP -> INT OPER |

EXP | 3 | EXP -> INT OPER |

EXP | 4 | EXP -> INT OPER |

EXP | 5 | EXP -> INT OPER |

EXP | 6 | EXP -> INT OPER |

EXP | 7 | EXP -> INT OPER |

EXP | 8 | EXP -> INT OPER |

EXP | 9 | EXP -> INT OPER |

OPER | * | OPER -> * INT OPER |

OPER | / | OPER -> / INT OPER |

OPER | + | OPER -> + INT OPER |

OPER | - | OPER -> - INT OPER |

OPER | EOF | OPER -> epsilon |

INT | 0 | INT -> 0 |

INT | 1 | INT -> 1 |

INT | 2 | INT -> 2 |

INT | 3 | INT -> 3 |

INT | 4 | INT -> 4 |

INT | 5 | INT -> 5 |

INT | 6 | INT -> 6 |

INT | 7 | INT -> 7 |

INT | 8 | INT -> 8 |

INT | 9 | INT -> 9 |

Assert that derivation for non terminal EXP and lookahead 0 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 1 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 2 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 3 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 4 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 5 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 6 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 7 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 8 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal EXP and lookahead 9 is "EXP -> INT OPER"

Test passed

Assert that derivation for non terminal OPER and lookahead "*" is "OPER -> * INT OPER"

Test passed

Assert that derivation for non terminal OPER and lookahead "/" is "OPER -> / INT OPER"

Test passed

Assert that derivation for non terminal OPER and lookahead "+" is "OPER -> + INT OPER"

Test passed

Assert that derivation for non terminal OPER and lookahead "-" is "OPER -> - INT OPER"

Test passed

Assert that derivation for non terminal OPER and lookahead EOF is "OPER -> epsilon"

Test passed

Assert that derivation for non terminal INT and lookahead 0 is "INT -> 0"

Test passed

Assert that derivation for non terminal INT and lookahead 1 is "INT -> 1"

Test passed

Assert that derivation for non terminal INT and lookahead 2 is "INT -> 2"

Test passed

Assert that derivation for non terminal INT and lookahead 3 is "INT -> 3"

Test passed

Assert that derivation for non terminal INT and lookahead 4 is "INT -> 4"

Test passed

Assert that derivation for non terminal INT and lookahead 5 is "INT -> 5"

Test passed

Assert that derivation for non terminal INT and lookahead 6 is "INT -> 6"

Test passed

Assert that derivation for non terminal INT and lookahead 7 is "INT -> 7"

Test passed