It is currently Mon Oct 20, 2014 4:03 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: BASIC compiler
PostPosted: Fri Jun 20, 2008 3:51 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Something that I've always really wanted for the BBC is a BASIC compiler, either on the BBC itself or, preferably, a PC type development tool. Just think, write your programs in BASIC and then compile them to 6502 assembler! :)

A while back I thought about doing one myself as an IDE on the PC with an expanded version of BBC BASIC, but it's quite a large project to do and one that is a bit outwith my expertise.

Kind regards,

Francis.


Top
 
 Post subject: Re: BASIC compiler
PostPosted: Tue Jun 24, 2008 9:27 pm 
Offline
 Profile

Joined: Thu Mar 27, 2008 9:07 pm
Posts: 14
There's a BASIC-to-C converter available for RISC OS.

http://www.martinkd.freeuk.com/bbc_c.html

So in theory you could use that with a BBC C compiler to convert BASIC to assembly.

http://mdfs.net/System/C/6502/

Of course there's no guarantee the output would be very good!


Top
 
 Post subject: Re: BASIC compiler
PostPosted: Wed Jun 25, 2008 10:55 am 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
A kind of roundabout way of doing it, but I do like your thinking! :)

I was really thinking more along the lines of something similar to Steve's SWIFT utility where you could program in BBC BASIC, compile it and then have the option of injecting it into an emulator to execute.

Maybe if I get all (currently 12) of my other programming projects out of the way I could try and make a start on my own utility, although I don't know how far I would get.

Kind regards,

Francis.


Top
 
 Post subject: Re: BASIC compiler
PostPosted: Wed Jun 25, 2008 1:56 pm 
Offline
User avatar
 Profile

Joined: Wed Jan 09, 2008 7:30 am
Posts: 406
That would make a useful addition to SWIFT, but I'll leave it for you're long list :) Writing something that covers all of BBC Basic would be a big task :) Possibly made easier (and produce smaller object code) if you could call some routines in the BASIC ROM though. But as these have moved about with different releases that wouldn't be easy, you're object code would need to inspect the machine and make adjustments accordingly.

Otherwise not using the BASIC ROM would require you to code everything, from integer and floating point representation, mathematical functions and even reading the ADVAL ports. OS routines would still be available though through the official vectors, so graphics wouldn't be too bad as a lot are in the OS ROM I think.

If you were having a stab, limiting it to just integers and a subset of BASIC would be a start.

A project not for the faint hearted :) Good luck !


Top
 
 Post subject: Re: BASIC compiler
PostPosted: Wed Jun 25, 2008 3:12 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
I am under no illusions of how big and difficult a project this would be, especially considering that I have never done anything like this before (not that it has ever stopped me before in the past! :D )

As you quite rightly suggest, if I do go ahead with it I will be starting off with implementing just a small set of the BASIC language.

Kind regards,

Francis.


Top
 
 Post subject: Re: BASIC compiler
PostPosted: Fri Aug 01, 2008 3:44 pm 
Offline
User avatar
 Profile

Joined: Fri Jul 25, 2008 2:47 pm
Posts: 190
ComputerConcepts "Accelerator" was a Basic compiler but it compiles to an intermediate G-code and then you run that under a G-code runtime environment (a bit like Java coding, I guess). Good compromise. Supported a subset of BBC Basic for the reasons above I would have thought.

There was also another compiler product but I can't remember any more than that.

I *really* wanted some floating point routines for standalone use and got a long way with disassembling Basic IV and recoding to 6502 standalone source... it was very BIG and gave up on it in the end...


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron