Finding FIRST and FOLLOW problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rizvi
    New Member
    • Jul 2007
    • 4

    Finding FIRST and FOLLOW problem

    The Grammer is given:

    S ---> id=E;
    E ---> E+T | E-T | T
    T ---> T*F | T/F | F
    F ---> P^F | P
    P ---> -P | L
    L ---> (E) | id | num
    --------------------------------
    I've fond the following FIRST and FOLLOW:

    FIRST:
    S = { id }
    P=E=T=F= { -, (, id, num }
    L = { (, id, num }

    FOLLOW:

    S = { $ }
    E = { ;, +, -, ) }
    T=F= {;, *, /, +, -, ) }
    P =L= {;, ^, *, /, +, -, ) }

    I think this answer is wrong. If so, Pls solve this.... pls....

    Thanks...
    Rizu.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Rizu. Welcome to TSDN!

    Can you explain what you are trying to accomplish?

    Comment

    • Rizvi
      New Member
      • Jul 2007
      • 4

      #3
      I am trying to complete parser table..

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Ah. Interesting.

        I haven't had a chance to review it yet, but maybe this article may be of some assistance.

        P.S., thanks for posting this. I have been trying to implement this in a string parser for a little while now without realizing what it was called.

        Comment

        Working...