Converting an LR(1) grammar to LL

exitsfunnel@yahoo.com (exitsfunnel)
4 Feb 2004 21:57:09 -0500

          From comp.compilers

Related articles
Converting an LR(1) grammar to LL exitsfunnel@yahoo.com (2004-02-04)
| List of all articles for this month |
From: exitsfunnel@yahoo.com (exitsfunnel)
Newsgroups: comp.compilers
Date: 4 Feb 2004 21:57:09 -0500
Organization: http://groups.google.com
Keywords: parse, question
Posted-Date: 04 Feb 2004 21:57:09 EST

Hello,


I have a very large YACC {LR(1)} grammar which I'm attempting to
convert to ANTLR which is LL(k). It makes heavy use of Left
Recursion. I'm able to convert some of the simpler pieces but some of
it is quite complicated. What follows is an example of the stuff I
can't figure out how to convert:


//BEGIN EXAMPLE
dimentia:
membrane B A
            |
A C membrane D
            |
gentle B A
            |
A C gentle D
;


gentle:
G
            |
dimentia B E C
            |
membrane B F C
            |
F C dimentia H
            |
F C membrane H
            |
membrane B E C
            |
E C dimentia H
            |
E C membrane H
;


membrane:
I
            |
J
            |
gentle B K
            |
        membrane L K
;
//END EXAMPLE


A couple of questions then. Is it possible that the above (about
which yacc has no complaints) can't be converted to LL? If there is
an alternative LL grammar and anyone could point me towards some
strategies for dealing with the situation I'd really appreciate it.
Thanks in advance.


-exits


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.