Re: Look for a LALR grammar for visual basic

Scott Stanchfield <thetick@magelang.com>
7 Sep 1997 15:39:16 -0400

          From comp.compilers

Related articles
Look for a LALR grammar for visual basic tsupplisson@suresnes.marben.fr (Thierry Supplisson) (1997-08-16)
Re: Look for a LALR grammar for visual basic thetick@scruz.net (Scott Stanchfield) (1997-08-19)
Re: Look for a LALR grammar for visual basic genew@vip.net (1997-08-20)
Re: Look for a LALR grammar for visual basic jrr@atml.co.uk (1997-08-24)
Re: Look for a LALR grammar for visual basic thetick@magelang.com (Scott Stanchfield) (1997-09-07)
Re: Look for a LALR grammar for visual basic genew@vip.net (1997-09-12)
| List of all articles for this month |

From: Scott Stanchfield <thetick@magelang.com>
Newsgroups: comp.compilers
Date: 7 Sep 1997 15:39:16 -0400
Organization: MageLang Institute
References: 97-08-050 97-08-052 97-08-065
Keywords: Basic, parse

> Scott Stanchfield <thetick@scruz.net> wrote:
> >Unfornately, my NDA with them prevents me from saying much more about
> >it... I think I can say that it was a fairly nasty beast in some areas:
> >Think about
> >
> > IF x = 1 THEN
> > END
> > 100: END IF
> >
> >which would complicate a grammar significantly (yes, VB allows a label
> >on things like "END IF" -- yuck!


Gene Wirchenko wrote:
> If you're going to allow goto, it makes sense to me to allow a
> branch to the end of a block (from within the block only I hope).


I'd agree if the label were on the next statement _after_ the if block,
as in


    IF x = 1 THEN
        END
    END IF
    100


or were on a separate line (a true null statement) before the END IF.


I'm pretty sure your C example would need to be


    if (x == 1) {
        exit(EXIT_SUCCESS);
target ; }


(note the semi for the null statement.)


Labels are normally only allowed in front of a statement. END IF isn't
a statement, but a block terminator. Allowing labels at the beginning
of any line makes the language incredibly nasty to implement with no
added benefit to a user...


-- Scott
--


Post a followup to this message

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