www.retrosoftware.co.uk
http://www.retrosoftware.co.uk/forum/

BASIC compiler
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=20&t=117
Page 1 of 1

Author:  FrancisL [ Fri Jun 20, 2008 3:51 pm ]
Post subject:  BASIC compiler

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.

Author:  JeffreyL [ Tue Jun 24, 2008 9:27 pm ]
Post subject:  Re: BASIC compiler

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!

Author:  FrancisL [ Wed Jun 25, 2008 10:55 am ]
Post subject:  Re: BASIC compiler

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.

Author:  SteveO [ Wed Jun 25, 2008 1:56 pm ]
Post subject:  Re: BASIC compiler

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 !

Author:  FrancisL [ Wed Jun 25, 2008 3:12 pm ]
Post subject:  Re: BASIC compiler

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.

Author:  ParasS [ Fri Aug 01, 2008 3:44 pm ]
Post subject:  Re: BASIC compiler

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...

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/