LL(2) to LL(1) conversion

Discussion in 'C Programming' started by Matthew Bowman, Nov 18, 2003.

  1. I'm in need of some assistance in converting an LL(2) grammar to an
    LL(1) grammar. I'm having difficulties with this. Note: this is for
    a school project and the grammar is not my choice. Thanks in advance
    for any help. The grammar follows:

    <program> ::= <explist>
    <explist> ::= <exp> <explist> | E
    <idlist> ::= ID <idlist> | E
    <exp> ::= '(' ')'
    | ID
    | NUM
    | '(' LAMBDA '(' <idlist> ')' <exp> ')'
    | '(' DEFINE '(' ID <idlist> ')' <exp> ')'
    | '(' IF <exp> <exp> <exp> ')'
    | '(' <exp> <explist> ')'

    note: E <=> epsilon

    thanks in advance!!!
    Matthew Bowman, Nov 18, 2003
    #1
    1. Advertising

  2. Matthew Bowman

    Artie Gold Guest

    Matthew Bowman wrote:
    > I'm in need of some assistance in converting an LL(2) grammar to an
    > LL(1) grammar. I'm having difficulties with this. Note: this is for
    > a school project and the grammar is not my choice. Thanks in advance
    > for any help. The grammar follows:
    >
    > <program> ::= <explist>
    > <explist> ::= <exp> <explist> | E
    > <idlist> ::= ID <idlist> | E
    > <exp> ::= '(' ')'
    > | ID
    > | NUM
    > | '(' LAMBDA '(' <idlist> ')' <exp> ')'
    > | '(' DEFINE '(' ID <idlist> ')' <exp> ')'
    > | '(' IF <exp> <exp> <exp> ')'
    > | '(' <exp> <explist> ')'
    >
    > note: E <=> epsilon
    >

    Alas, as you have no question about the standard C programming
    language, you're OFF TOPIC here (which you would have known had
    you read the FAQ, etc. etc.)

    Try news:comp.compilers.

    HTH,
    --ag




    --
    Artie Gold -- Austin, Texas
    Oh, for the good old days of regular old SPAM.
    Artie Gold, Nov 18, 2003
    #2
    1. Advertising

  3. Artie Gold wrote:
    > Alas, as you have no question about the standard C programming
    > language, you're OFF TOPIC here


    My sincere apologises :)

    --
    Matthew Bowman

    Computer Science Undergraduate
    Georgia Institute of Technology

    "Imagination Rules The World!"
    Matthew Bowman, Nov 18, 2003
    #3
  4. Matthew Bowman

    Guest

    Try posting to comp.theory some one there may help!
    , Nov 18, 2003
    #4
  5. Matthew Bowman

    Derk Gwen Guest

    (Matthew Bowman) wrote:
    # I'm in need of some assistance in converting an LL(2) grammar to an
    # LL(1) grammar. I'm having difficulties with this. Note: this is for
    # a school project and the grammar is not my choice. Thanks in advance
    # for any help. The grammar follows:
    #
    # <program> ::= <explist>
    # <explist> ::= <exp> <explist> | E
    # <idlist> ::= ID <idlist> | E
    # <exp> ::= '(' ')'
    # | ID
    # | NUM
    # | '(' LAMBDA '(' <idlist> ')' <exp> ')'
    # | '(' DEFINE '(' ID <idlist> ')' <exp> ')'
    # | '(' IF <exp> <exp> <exp> ')'
    # | '(' <exp> <explist> ')'

    Left factor.

    <exp> ::= (<exp1> | ID | NUM
    <exp1> ::= ) | LAMBDA (<idlist>) <exp>) | DEFINE (....................


    --
    Derk Gwen http://derkgwen.250free.com/html/index.html
    I ASSURE YOU WE'RE OPEN!
    Derk Gwen, Nov 18, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luc Bisson

    Framework 1.0 to 1.1 conversion

    Luc Bisson, Nov 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    594
    Jim Blizzard [MSFT]
    Nov 19, 2003
  2. Amka
    Replies:
    8
    Views:
    522
    Jay B. Harlow [MVP - Outlook]
    Jan 28, 2004
  3. Thomas Bartzick
    Replies:
    0
    Views:
    2,258
    Thomas Bartzick
    Jun 26, 2003
  4. Troels Smit

    Conversion 1QN -> 2'Complement

    Troels Smit, Jun 30, 2003, in forum: VHDL
    Replies:
    1
    Views:
    4,149
    Troels Smit
    Jul 1, 2003
  5. , India
    Replies:
    2
    Views:
    446
    Fraser Ross
    Sep 15, 2009
Loading...

Share This Page