Re: BNF for a BASIC compiler

"Michael Haardt" <>
13 Oct 2002 16:04:08 -0400

          From comp.compilers

Related articles
BNF for a BASIC compiler (Michael Ness) (2002-09-29)
Re: BNF for a BASIC compiler (Scott Nicol) (2002-10-13)
Re: BNF for a BASIC compiler (Michael Haardt) (2002-10-13)
Re: BNF for a BASIC compiler (antoine) (2002-10-13)
| List of all articles for this month |

From: "Michael Haardt" <>
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:


Post a followup to this message

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