New Basic Compiler

General discussion for topics related to the FreeBASIC project or its community.
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

New Basic Compiler

Post by John Spikowski »

Charles Pegge released a standalone version of his JIT Basic compiler. (Oxygen Basic) I think he has something (even in it's alpha form) worth having a peek at.

http://www.allbasic.info/forum/index.php?topic=8.0
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Post by duke4e »

This one sounds promising. Too bad it's just an interpreter.
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Post by marcov »

That post is a bit strange. It compiles straight to x86, and accesses C directly, but is a JIT ?

duke4e: I don't see anything about an interpreter in the post? He describes it as a JIT compiler.

But it sounds like a native, standalone backend AND has Inheritance. It is the first time John posted a new tool that actually holds some attractions.

Bad name though, Oxygene is already taken as name for a JIT development tool (though it is also marketed as "Delphi Prism" http://www.remobjects.com/oxygene.aspx)

John: a post how sources are split up in multiple modules would also be nice.
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

It is the first time John posted a new tool that actually holds some attractions.
As my dad would say ...
Even a blind pig can find an acorn in the mud.
:)
Kot
Posts: 336
Joined: Dec 28, 2006 10:34

Post by Kot »

Strange, my antivirus reports files cco2.exe, co2.exe and eo2.exe as infected with TR/Crypt.XPACK.Gen2.
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Post by duke4e »

JIT compilers arent as nearly fast as static compilers, so thats what I had in mind when I said "interpreter"
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

JIT compilers arent as nearly fast as static compilers, so thats what I had in mind when I said "interpreter"
O2 kicked every Basic compilers ass in prior AllBasic code challenges. This includes FreeBASIC and PowerBASIC. Don't be fooled by the JIT nomenclature.
fsw
Posts: 260
Joined: May 27, 2005 6:02

Post by fsw »

This one is Oxygen and not Oxygene as mentioned above...

AFAICS Oxygen is both:

1.) JIT compiler - compiles source code fast and executes it in memory
2.) Native compiler - compiles source code to executable files (assembler, linker)

I've tested Oxygen and must say it compiles very, very fast - at least for the short examples that are provided.

The only "downside " (if you can call it that) is that a resulting executable is small but depends on a runtime dll (Oxygen.dll).

And it looks like this runtime dll is actually the compiler itself.
Unusual approach but... it's one way of doing it.

I suppose if the runtime portion of the compiler dll could be compiled in a separate dll the runtime dll could be far smaller.
Or better convert the runtime in OxygenBasic and link it into the compiled exe...

Also the footprint of Oxygen is incredibly small.

All in all IMHO it's a neat project that deserves attention, especially when it's coded in FreeBASIC (source code of the ThinBasic version is available in the ThinBasic Forum - don't know if Charles makes the code of the standalone version available).


IMO this project shows how mature FreeBasic actually is!

This said, both projects (FreeBasic and Oxygen) deserve my respect.

fsw
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Post by marcov »

duke4e wrote:JIT compilers arent as nearly fast as static compilers
This is not true per se.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Post by aurelVZAB »

My antivirus detect TR/Crypt.XPACK.Gen2. to.
I think that this is becose some parts of package are compressed
with upx .Who know what might be else...
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

I use Kaspersky Internet Security and it doesn't have a problem with it. I remember a while back on the thinBASIC forum they were having issues generating a standalone executable without antivirus apps complaining. (which was a packed set of files including the interpreter)

Charles is a smart and generous person and I trust whatever he offers as a download.
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

Kot wrote:Strange, my antivirus reports files cco2.exe, co2.exe and eo2.exe as infected with TR/Crypt.XPACK.Gen2.
I believe the source is included. Compile them yourself!

James
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

Charles and I got the Oxygen Basic JIT compiler embedded in ScriptBasic if you want to take a peek at that aspect of the compiler.

http://www.allbasic.info/forum/index.php?topic=13.0
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

@John
I just read your blog (daughter) and uhm... anyway, back to programming (no need to get all emotional here).

I think the idea of having an interpreter (JIT or not) is not such a bad idea. The main advantage of having an interpreter is (usually) ease of debugging. Most interpreters have some facility you can hook into to get a debugging facility going (LUA has it's hooks, Python has it's facilities(pdb, peval etc....)).

Combining the benefits of an interpreter (debugging) with the benefits of native code runtime performance (by turning the bytecode into executable code using Ahead of Time compilation) sounds like a good idea to me.

Microsoft does something like that with the .NET framework (it can turn CIL into native code), GCJ can turn Java bytecode into native code and there are more projects out there doing the same thing.

Oxygen is closely related to ThinBasic which has a nice debugging facility (ThinBASIC is a BASIC interpreter).

ThinBASIC and Oxygen are not open source though.

Scriptbasic is open source.
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Post by marcov »

AGS wrote:@John
I just read your blog (daughter) and uhm... anyway, back to programming (no need to get all emotional here).

I think the idea of having an interpreter (JIT or not) is not such a bad idea. The main advantage of having an interpreter is (usually) ease of debugging. Most interpreters have some facility you can hook into to get a debugging facility going (LUA has it's hooks, Python has it's facilities(pdb, peval etc....)).

Combining the benefits of an interpreter (debugging) with the benefits of native code runtime performance (by turning the bytecode into executable code using Ahead of Time compilation) sounds like a good idea to me.
This largely doesn't make sense. The interpreter is on the level of the bytecode (which is stylized assembler), not on the level of the target language.

I said largely, because most JIT languages are a bit more self describing, and the debugger could somehow plugin into that a bit.

But that is secondary damage control (essentially a slightly different way of debug info loading)
Microsoft does something like that with the .NET framework (it can turn CIL into native code), GCJ can turn Java bytecode into native code and there are more projects out there doing the same thing.
They are JIT yes, but their debugger parts are just hard work (very hard even, since fullblown JITs are more complicated than native compilers), not a logical consequence of them being JIT.
Locked