Related articles |
---|
BNF for a BASIC compiler mness1978@hotmail.com (Michael Ness) (2002-09-29) |
Re: BNF for a BASIC compiler snicol@apk.net (Scott Nicol) (2002-10-13) |
Re: BNF for a BASIC compiler michael@moria.de (Michael Haardt) (2002-10-13) |
Re: BNF for a BASIC compiler the-xogos@ifrance.com (antoine) (2002-10-13) |
From: | "Michael Haardt" <michael@moria.de> |
Newsgroups: | comp.compilers |
Date: | 13 Oct 2002 16:04:08 -0400 |
Organization: | Compilers Central |
Keywords: | Basic, parse |
Posted-Date: | 13 Oct 2002 16:04:08 EDT |
> Here is my first attempt at a defining a grammer using BNF. Is this the
> way BNF should look? Can anyone point out any mistakes I'm making? One
> thing that I am concerned about is the two token statment "END IF".
In my BASIC interpreter, I used this flex rule in the scanner:
ENDIF end[ \t]*if
It reflects the fact that some dialects use a space and others don't,
but either way, it is just one token for the parser. BASIC is obscure,
and that's not the worst yet, thinking of DATA.
I use a hand written parser, but if you are interested in the scanner,
check out the file token.l. The interpreter is available at:
http://www.moria.de/~michael/bas/
Michael
Return to the
comp.compilers page.
Search the
comp.compilers archives again.