By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,407 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,407 IT Pros & Developers. It's quick & easy.

LL(2) to LL(1) conversion

P: n/a
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!!!
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

Nov 13 '05 #2

P: n/a
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
gt*****@mail.gatech.edu
Computer Science Undergraduate
Georgia Institute of Technology

"Imagination Rules The World!"

Nov 13 '05 #3

P: n/a
Try posting to comp.theory some one there may help!
Nov 13 '05 #4

P: n/a
gt*****@mail.gatech.edu (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!
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.