On Mon, 08 Mar 2004 13:58:24 -0600, "Stephen J. Rush"
<steverush1@[EMAIL PROTECTED]
> wrote:
<snip>
>If you've never tried it before, start with the smallest subset of BASIC
>that you can write nontrivial programs in. I've never tried to analyze
>it, but I suspect that QBasic's grammar isn't LL1. You can write a
>recursive-descent parser in any language. It helps if the language
>supports recursive functions, so you don't have to maintain your own
>stack, but you could theoretically do it on a Turing machine, given a few
>man-centuries of programming effort.
BCET is a (working) Basic compiler written in Basic. For the portions
of the language currently implimented, you need the current token, and
the next token to decide what to do. Is that LL1? I never really
bothered to figure out just what all of those mean.
>
>Seriously, it's been done in Pascal and QuickBasic. I worked through
most
>of Jack Crenshaw's "Let's Build A Compiler!" tutorial (see
>http://compilers.iecc.com/crenshaw/),
translating his Pascal code into
>QuickBasic as I went along. It wasn't that hard, given QB's Pascal -
like
>control structures and the trick of using strings to represent sets, so
>that INSTR() can serve as the membership function. Crenshaw's "Tiny"
>language is far smaller than any BASIC, but I wound up with a compiler
>that actually worked (under real-mode DOS; *don't* try this in a
>Windows environment).
I read Crenshaw's tutorial, and for me, it make a nice overview, but I
didn't really get anything new out of it. But, it is a good starting
point.
>
<snip>
BTW, BCET includes utilities to dump/format it's internal work files.
By looking at the formated work file, and the intermediate files, you
could get a pretty good idea how I go from basic source to assmbler.
2nd URL in the Sig.
--
Arargh403 at [drop the 'http://www.'
from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html
To reply by email, remove the garbage from the reply address.


|