BASIC Developer & Support Resources > Compilers

Alternative O2 Builder

<< < (2/7) > >>

efgee:
Charles,


--- Quote from: cevpegge on September 23, 2010, 03:52:26 am ---Oxygen makes intensive use of FreeBasic Inline Assembler (which is slightly preprocessed GNU GAS using Intel notation). The Oxygen Assembly language is largely compatible with this. We also have a high degree of compatibility between FreeBasic and OxygenBasic language.

--- End quote ---

If the Oxygen Assembly language is largely compatible with gas, maybe you could have saved yourself quite some time and utilize the whole "BASIC language" frontend from freeBasic.
Like:


--- Code: ---fbc -gen oxygen hello.bas

--- End code ---

if oxygen is chosen than co2.exe is used instead of gas.exe.
The code to make this possible could have been done in one afternoon...

With that you could have had tons of new users/testers in one night!

efgee

JRS:
I'm going to take a guess here but I think Charles has his own ideas how a Basic and a hand coded compiler should work.

I don't see why O2 ASM as defined in FreeBASIC and using the GNU Assembler should not translate well to BCX Inline ASM and compiled with MinGW-gcc under windows for 32 and 64 bit.


--- Quote ---The GNU Assembler (GAS) is the default back-end to the GNU Compiler Collection (GCC) suite. As such, GAS is as portable and retargetable as GCC is. However, GAS uses the AT&T syntax for its instructions, which some users find to be less readable than Intel syntax. As a result, assembly code written inline in a C code file for GCC must also be written in GAS syntax.

GAS is developed specifically to be used as the GCC backend. GCC always feeds GAS syntactically-correct code, so GAS often has minimal error checking.

GAS is available as a part of either the GCC package or the GNU binutils package.

--- End quote ---

cevpegge:

The important thing at present is to work with a single "incarnation" of Oxygen when making a large number of changes. But you have given me ideas about emitting various types of code. With a few adjustments Oxygen could easily emit C or Assembly code, as well as binary. :)

One curious phenomenon: When Oxygen was just an Assembler it was around 150K in size. Adding Basic produced a rapid escalation to around 370k. But while I continue to add new functionality and refactor at the same time, the size has not changed significantly in several months. It seems to have reached a critical mass where only small changes are required to add new functionality. I can always find ways to reduce the code before adding new things. Its a bit like file zipping by hand.

Charles

JRS:

--- Quote ---The important thing at present is to work with a single "incarnation" of Oxygen when making a large number of changes.

--- End quote ---

All I'm saying is that it would seem easier to integrate C libraries (reading headers, inline C in O2Basic, ...) if you used a C compiler to compile your initial compiler. (say that 3 times in a row)  :)

I hate to see you wasting your time when needed functionality already exists when using the correct compiler.



cevpegge:
John,

I am considering porting to C but this is not a priority right now. It would disrupt the work flow. Much of my design effort at the moment is in getting the architecture of the program right. This is more or less language-independent. With FreeBasic firmly embedded in my subconsciousness it's one less thing to think about.

C headers are not a problem. Most of the work to read them has been done.

Charles

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version