View Full Version : Oxygen Compiler Compiler
Charles Pegge
08-07-2009, 16:00
This kit (zip attached) generates a simple console compiler for Oxygen, called co2 :D
It contains all the necessary components and instructions to do this, in a minimalist sort of way.
Applications compiled in Oxygen require either thinBasic_Oxygen.dll or Oxygen.dll to be included in the same folder as the executable.
To demonstrate an application, I have produced a compiled version of the AllBasic WordCount Code Challenge:
to run this you will also need a copy of bible.txt. - Being precompiled It takes only 0.176 Seconds to do the task.
http://www.allbasic.info/forum/index.php?topic=683.new#new
Petr Schreiber
08-07-2009, 17:30
That is excellent Charles, standalone compiler in less than 1/4 MB :)
Charles Pegge
08-07-2009, 17:49
Hi Petr,
Bytes are strictly rationed :) I am always looking for ways to eliminate redundant code as it usually improves the program. I hope we will be able to maintain the small footprint for lightweight distribution of applications.
Charles
Charles, ran find under Windows 7 - 64 bit, to let you know.
I guess the simple way to think about what it does, as it gets confusing with the correct terminology to dummies like me. You can take your source code written in oxygen syntax and from the console make an executable from it. This executable will require the thinBasic_Oxygen.dll file with it to run elsewhere. Will it also work on combination thinBasic/Oxygen source code as it does when you use the src="oxygen source code here" within a thinBasic source file?
Michael Hartlef
08-07-2009, 22:20
And I thought it was a Compiler compiler, a toolset to create compilers. There that term is being used in the past. :unguee:
Charles Pegge
08-07-2009, 22:49
Kent,
Thanks for testing - glad to know it works in such a different environment. The programs you run directly in TB can also be compiled from TB or compiled with CO2 independently providing there are no thinBasic dependencies.
Michael,
Yes I thought that might be the case. My notion of a compiler compiler is cheating somewhat but it is possible to add new functionality to CO2 - like language extensions and feed them to the underlying oxygen compiler - so in that sense you could regard it as a potential tool set. :)
Charles
Hello Charles,
I downloaded thinbasic (1.8.6.0), the newest oxygen and co2 and compiled co2maker and the test program that shows the messagebox.
Every thing compiles fine if I exchange the oxygen dll from tb1.8.6 with the newest one from 8-14-2010 (otherwise the compiled co2 exe is invalid) but the message box doesn't show up.
Is co2 not working with the newest version of thinbasic/oxygen?
Thanks in advance
efgee
Hi efgee
for me everything works okay, in this thead :
http://community.thinbasic.com/index.php?topic=3578.0
there is a discusions about your problem regarding running co2 in winxp, and it is solved.
just download the new oxygen from here:
http://community.thinbasic.com/index.php?topic=2517
replace the thinbasic\lib\thinBasic_Oxygen.dll with the new one, then in the new downloaded oxygen folder:
\Examples\DLLandEXE\ConsoleCompilerMaker :
double click on co2_maker.tbasic file so it will make co2.exe now either you write from console co2 HelloWin1.bas or double click Compile_HelloWin1.bat which contains just the line co2 HelloWin1.bas
and the new file HelloWin1.exe will appear, double click it and it will show Hello World window.
Hello Zak,
thank you for your reply.
Actually what you told me to do I had already done, but your response showed me that I have to look elsewhere, so I did.
I compared the 3kb test.exe (the one that worked fine; from tb1.8.0) with the new 2.5kb test.exe (the one that didn't show the msgbox and found out that the new exe needs oxygen.dll and not thinbasic_oxygen.dll.
Copied the thinbasic_oxygen.dll into my examples directory and renamed it to oxygen.dll.
All works fine now as the messagebox is shown.
Thanks again.
efgee
ErosOlmi
17-08-2010, 06:21
The problem (or the beauty ;) ) is that Charles updates Oxygen almost at daily basis so I cannot update thinBasic version every day or so
Every time I release an updated thinBasic version (official or beta) I always include latest Oxygen module available.
After that you have to follow Charles updates at the mentioned link:
http://community.thinbasic.com/index.php?topic=2517
Check the bottom of that post and check "Last Edit ..." date indication to see if Charles has updated it recently.
Charles Pegge
17-08-2010, 08:11
Often updated twice daily or more :D
The co2 compiler compiler is rather volatile at present so you need to make sure that you use the co2 included with the current release. Sorry if this has caused any confusion.
The co2 dependency should be for thinBasic_Oxygen.dll, and this is imprinted into every executable that co2 compiles.
Charles
@Eros,
I understand completely, don't worry.
@Charles,
thank you for your hard work.
bye
efgee