Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Compiler > Re: BASIC gramm...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 14 Topic 75 of 149
Post > Topic >>

Re: BASIC grammar

by "Scott Moore" <samiam@[EMAIL PROTECTED] > Mar 10, 2004 at 08:22 AM

"Johnathan" <zork_666@[EMAIL PROTECTED]
> wrote in message
news:404c846b$0$22531$5a62ac22@[EMAIL PROTECTED]
> Hi,
>
> I'm looking for a BASIC grammar.  Not necessarily the original BASIC
> language - I'd be happy with a more modern dialect like QBasic.  I can
> infer a lot from Microsoft's QBASIC help file, but I'd really like to
> get my hands on a LL(1) grammar.  I could probably try to write my own,
> but I don't know enough about compiler theory to do it.  I'd like to
> take a stab at writing a recursive descent parser.  So bearing this in
> mind, small is beautiful at this stage. :)
>
> Thankyou,
> Johnathan

Basic was one of the first languages I ever compiled/interpreted. You can,
by the way, find a Basic interpreter written in basic at:

www.moorecad.com/classicbasic

I always wrote my own grammar for Basic. You learn a lot by doing that,
and if you are going to subset Basic, you should learn how to construct
a grammar for that. Don't get hung up on the formalities. Do a "railroad
track" diagram first. The grammar will flow from that.

I recommend you use Basic as your language to implement in. Don't laugh.
you learn way more about a language by trying to write in it, and your
result will be able to compile/interpret itself -- a real, satisfying
goal of your work.

I also recommend you try making an interpreter first, at about the tolken
level. You will learn a lot from that project.

When you go fro mthe compiler, compile for a virtual machine that takes
abstract instructions on a stack machine. Its simple, you can always
add true machine code generation if you like later, and the entire project
will be up and running faster with fewer machine language hassles.

You can build the VM in the same language, in fact you can put it into
the compiler itself.

Luck.




 14 Posts in Topic:
BASIC grammar
Johnathan <zork_666@[E  2004-03-09 01:35:52 
Re: BASIC grammar
erewhon@[EMAIL PROTECTED]  2004-03-08 14:51:57 
Re: BASIC grammar
Johnathan <zork_666@[E  2004-03-09 04:52:32 
Re: BASIC grammar
"Stephen J. Rush&quo  2004-03-08 13:58:24 
Re: BASIC grammar
Johnathan <zork_666@[E  2004-03-09 08:02:15 
Re: BASIC grammar
arargh403NOSPAM@[EMAIL PR  2004-03-08 16:01:11 
Re: BASIC grammar
Johnathan <zork_666@[E  2004-03-09 19:16:56 
Re: BASIC grammar
arargh403NOSPAM@[EMAIL PR  2004-03-09 14:29:56 
Re: BASIC grammar
arargh403NOSPAM@[EMAIL PR  2004-03-10 02:14:26 
Re: BASIC grammar
arargh403NOSPAM@[EMAIL PR  2004-03-08 15:47:38 
Re: BASIC grammar
"Markku Alén" &  2004-03-08 23:30:26 
Re: BASIC grammar
Johnathan <zork_666@[E  2004-03-09 19:22:03 
Re: BASIC grammar
"Markku Alén" &  2004-03-21 02:31:17 
Re: BASIC grammar
"Scott Moore" &  2004-03-10 08:22:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 22:49:31 CDT 2008.