PDA

View Full Version : Freebasic to get C emitter



Charles Pegge
20-01-2010, 12:09
Plans afoot for FreeBasic to emit C instead of Asm. This means that FreeBasic will be useable on any platform (and any hardware) that supports the GCC compiler.

V1ctor


Thanks. There were (and still are) many fix to be done in the gcc emitter, but it will allow FB to be ported to new platforms in the future (say x86-64, ARM), keeping it alive for much longer (don't let BASIC die!). Besides the gain with optimizations; in my tests, the gfx demos ran at least 2 times faster with "-O max"; i guess it'll be the same with the math intensive apps.

It's pretty functional already, but i still need to fix a couple of ICE's and test it against the test suite, plus rebuilding fbc completely using the emitter.
....
Just to make it clear, FB won't just translate BASIC to C. Gcc is used as a high-level assembler, not a single C header is ever included - you can also use OOP that's ABI-compatible with g++ (a C++ compiler) using gcc to compile (a C-only compiler).

The gcc emitter doesn't change anything in the front- and the middle-end of the compiler, so syntax and semantic checks continue to be done.


Discussion here:

http://www.freebasic.net/forum/viewtopic.php?t=14849

kryton9
20-01-2010, 23:16
Charles, reading that other long topic we talked about 6 months or so ago, there it seemed Victor had left or didn't have time. So that was a good find and nice to see him respond.

Are you able to access that version yet?

Charles Pegge
21-01-2010, 00:06
No Kent, but I would anticipate a release in the next few months, after some rigorous testing. & FBC has to be self compiled with the new emitter so that everything is expressed in C.

jcfuller
21-01-2010, 00:31
Plans afoot for FreeBasic to emit C instead of Asm. This means that FreeBasic will be useable on any platform (and any hardware) that supports the GCC compiler.


Unfortunately I don't think there is a gnu gcc for Win64. I think there may be a fork (beta) but not an official gnu port.

James

kryton9
21-01-2010, 04:57
No Kent, but I would anticipate a release in the next few months, after some rigorous testing. & FBC has to be self compiled with the new emitter so that everything is expressed in C.


Self compiled... wow. That was something a lot of users were asking for and but many said it wasn't necessary... but I guess a lot of work went on behind the scenes to get it this far.

John Spikowski
21-01-2010, 10:14
Personally I think it's a noble attempt at saving FreeBASIC but a crippled one at that. No support for C includes is a turnoff from the start.

BCX is much more mature and supports COM/container, Linux and the MacOS with multiple GUI toolkits. Including C headers (and inline C code) in Basic code is a dream and the way a Basic to C translator should work. IMO

I guess FreeBASIC is too big to fail. :?

Charles Pegge
22-01-2010, 08:16
Native C headers would be great. If I understand V1ctor's remarks correctly - The FreeBasic emitter will use C as a sort of generic Assembler and there is currently no provision planned for transferring inline C expressions directly to this output, or to parse C expressions within FreeBasic itself. But I see no reason why this should not be possible in the future.