Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
freeBASIC (a 32-bit QB-syntax compatible compiler) preview..
Yeah, it's bad ass. Also, unlike other qb compilers made recently. It optimizes expressions and redundant operations. If he fixed the DAG that is. If you finish it v1ctor, C is past for me.

Btw, i had nothing to do with the compiler.
oship me and i will give you lots of guurrls and beeea
Oh, v1ctor, this is just plainly awesome! I already wanted something like this to happen Wink I'd leave anything if this is released Tongue It's the powerful combination of C + QB, including a SMART compiler... Wink

Quote:The GFX tests are using the TinyPTC library coz.. well, there's nothing easier around to use.. of course it's not the fasted alternative, using DX would give much better results and a QB-ish full screen Wink, but the compiler still needs function pointers to access DX directly (damn COM interfaces).
Maybe you can convert the FreeQB code to C++ before compiling, and compile it with a DX/OpenGL compatible C++ compiler (like VC++ 6.0). Because then you only need to specify you're using OpenGL32.LIB, GLU32.LIB, and GLAUX.LIB (/windows/system32/), and in the FreeQB code you only need to include, and :-? It's just a thought Tongue
That would require the user to have VC++. Better make things standalone.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
Maybe it's possible to include VC++ or any other suitable compiler?
you don't need to use vc or anything else, you can link any win32 lib you like to freebasic programs.
oship me and i will give you lots of guurrls and beeea
The ideal would be to be able to download a standalone compiler. And that would mean package free tools, like he's already done. Relase that as a base, and also have an IDE project to go along with it. I'm lazy, poor and untalented so I couldn't do it, but i'd be glad to document the runtime or something.

As for the name, hmm... you could always name it FreeBase (Free BAsic Sytax Evaluator), and have the satisfaction of knowing your compiler is a crack reference. Or I guess you could use BASE instead of BASIC for anything really, to move away from all the other crappy "Letter/Word + BASIC" naming conventions. QuickBase, FuBase, BarBase, etc.

If you wanted to move away from BASIC in general:
it's really popular to name programming stuff after animals.
Lots of animals here:

If not an animal, maybe something mythical:

Personal fav from there is "Adaro" or "Pissed off Mermaid throwing Fish".

You could use a word generator. Fantastic one here:

If you have a word, it shouldn't be too terribly hard to come up with an acronym for it, especially if it has a 'B'. That's how everyone else comes upwith an acronym anyway. That, or you could throw it on top of the convential "Basic".

But, circling back around to that:
If it's open source: ShareBasic, PeerBasic, etc. Or BeerBasic. But if you made it yourself, there's always the ultimate: VicBasic (Or VicBase! or Vic-on-a-Stick, VoaS for short!).
wtf is wrong with "freeBASIC"?
Call it UBC. Just like UGL but the "BC" of course stands for "Basic Compiler".

FreeBasic is fine by me at any rate. Smile

Now... there have been a lot of promises of new QB-like 32-bit compilers over the years... finish this one! Tongue I mean that seriously... the demo's are really showing promise in my opinion.
As far as i've seen, it's pretty much as functional as qb. But much better.
oship me and i will give you lots of guurrls and beeea
Alright, thanks to anyone that replied, i hope you will be able to play yourselves with the real thing soon ;)

Let me try to answer some questions.. er

Quote:What assembler do you use, masm?

I started emitting code to MASM, but as it is only for Windows, not *really* free, and doesn't support any kind of high-level debugging definitions (nor NASM or FASM does), then i moved to GNU's binutils. GAS with intel syntax looks pretty much the same (inline ASM won't be too different than the usual), and it's the only assembler that allows high-level debugging, as it's the backend of GCC - GDB-Insight will be the debugger, it's completely visual, but a resource hog.. nothing is perfect.

Quote:What else is needed to compile itself? And also coding this in basic itself must be one big challenge, congrats on that.

Other than a bunch of rtlib routines not yet implemented, the compiler must support arrays on user type fields, as i used them in many modules. It needs DATA statements too, and it's not that simple to add, as it may seem to be.

Most difficult parts were implementing trees, hash tables and a DAG (not used yet) in QB w/o pointers, other than that, code is divided in 16 modules (the recursive-descent parser is sliced in 6 parts). There is a just a global struct shared between the modules, everything else is accessed using getters's and setter's.

Quote:I didn't know GNU as could do intel syntax like that. For some reason I thought it was AT&T only.

Me neither ;), i started looking for an assembler when i gave up using MASM and when reading the not-that-great-but-enough-for-open-source GAS' manuals i found the .intel_syntax directive. Code looks very close to MASM, the weird parts are in the data allocation, but inline ASM won't use that so..

Quote:I would be happy to help with the rest of the runtime library if it might speed things up. I'm pretty comfortable with C. I wouldn't mind being given the least fun parts to do, really - anything for this compiler.

Sure, i'll need help to implement the QB's GFX routines (SCREEN, PSET, LINE, etc), i was thinking about using SDL as it's portable.. but runtime can get really big, i remember seeing 200kb DLL's coming with apps using SDL, dunno.

Quote:... the code is really nice. I can't really give any judgements on speed, it's definately a step up from old man QB. It sure as hell kicks the crap out of libertybasic, it's simple and the executables are small, too.

I checked the code generated by PureBASIC, blitz3d, RealBASIC, iBASIC, PowerBASIC and some others commercial alternatives, only PB can gen better code in some compound statements, but when the DAG (Direct-acyclic Graph) module start to be used, code will look great (sub-expressions eliminated, better register usage, etc). RT lib is being written very modularized, so i think EXE's sizes won't be too big, as LD will link just the used objs.

Quote: Btw, i had nothing to do with the compiler.

Nah, if it wasn't Blitz pointing me out the right ways to do a real compiler, FB would be just a toy now :). You could have scanned the few hundred of pages of the Dragon Book for me, but.. j/k ;)

The web host is being paid by him too so.. i'll put some pr0n stuff there soon to attract more ppl, you know..

Quote:Maybe you can convert the FreeQB code to C++ before compiling, and compile it with a DX/OpenGL compatible C++ compiler (like VC++ 6.0)

The emit/back-end module is say 99% independent of the front-end, it could be changed to emit C code later, but that's not my plan, while asm code won't ever be so good as the one a C optimizing compiler can generate, it will good enough when comparing with any commercial BASIC compiler - and hey, you will be able to use inline ASM if want more speed ;).

Using DirectX directly is a matter of adding function pointers, and i plan to do that after the compiler compiles itself. I don't want to include any closed-source tools, maybe some "abandonawares" from M$, like the resource editor.

What is really needed (and that's the hardest part coz doing by hand can be very error prone) is converting the C headers from Win API's and from any lib like OpenGL, to FB's syntax (that's QB/VB-like).. i guess it would be easier to reuse the include files that the VB community already translated from C.. or the ones that come with PowerBASIC, but then you have the copyright crap.. an automated tool would be better.. h2bi or such.

Quote:The ideal would be to be able to download a standalone compiler. And that would mean package free tools, like he's already done.

Yeah, exactly, it will come only with free/open-source tools, all currently from GNU: the assembler (AS), linker (LD) and archiver (AR, that's only need when creating static libs). I need yet to write a front-end to the compiler (FBC), i'm atm using batch files to call FBC, AS and LD, in that order.

Now about the name, heh.. it was going to be called uniBASIC, but there's already one with that name (a commercial one used in mainframes), so i changed to freeBASIC, as it will be open-src and there's just a "freebasic" listed on google that's a defunct project from 1998 or so. I can't change the name now as everything has a "FB" internally and the web site is being done with that name in mind ;)

In next weeks i'll add all string, math and memory routines missing in the run-time library, then add arrays on user def fields and try to get the compiler to compile itself, the first release will come next.. probably before xmas ;)

Again, thanks for all the feedback.. and, hey, someone now make an text-mode QB-ish IDE ;).. anyway, compiler reports error messages compatible with M$/VC++'s format, so any IDE or text-editor will be just fine.


Forum Jump:

Users browsing this thread: 1 Guest(s)