0

I need to construct the clr parser for the following grammar:

E->E+T|T
T->T*F|F
F->(E)|id

I am confused what will the look aheads will be. I have tried to solve the first few item sets but something seems to be wrong.

Gergely Toth
  • 6,638
  • 2
  • 38
  • 40

1 Answers1

0

Hope this helps After the comma is the lookahead and / means multiple lookaheads

I0: E'-> .E,$
    E->.E+T,$/+
    E->.T, $/+
    T->.T*F, $/+/*
    T->.F, $/+/*
    F->.id, $/+/*

I1: E->T., $/+
    T->T.*F, $/+/*

I2: T->F., $/+/*
I3: F->id., $/+/*
I4: E'->E., $
    E->E.+T, $/+
I5: E->E+.T, $/+
    T->.T*F, $/+/*
    T->.F, $/+/*
    F->.id, $/+/*
I6: E->E+T., $/+
    T->T.*F, $/+/*
I7: T->T*.F, $/+/*
    F->.id, $/+/*
I8: T->T*F., $/+/*

If I have missed out something then leave a comment so we can fix it together

mk1024
  • 159
  • 1
  • 2
  • 11