Oxygen Basic
Information => Open Forum => Topic started by: JRS on January 05, 2013, 09:29:31 PM
-
This looks interesting and might be worth having a peek.
C-- Project Site (http://www.cminusminus.org/)
Suppose you are writing a compiler; how will you get quality machine code? You might write your own code generator---but that's a lot of work. You might use somebody else's: perhaps VPO, MLRISC, or the gcc back end. But each of these impressive systems has a rich, complex, and ill-documented interface, and furthermore, to use MLRISC you must write your front end in ML, to use gcc you must write it in C, and so on. You might generate C, if you can live without multiple results in registers, proper tail calls, computed gotos, accurate garbage collection, and efficient exceptions.
You would be much happier with one portable assembly language that could be generated by a front end and implemented by any of several code generators. Such a language should serve as the interface between high-level compilers and retargetable, optimizing code generators. Authors of front ends and authors of code generators could cooperate easily. C-- is that language.
-
Hmm. This project seems to have come to a halt in 2008, but I like the general concept of a C--.
My intermediate code is more on the assembler side, and I am currently working on 'dead code removal' in this layer. It is proving to be quite tricky to do efficiently, though very important when working with large code libraries.
Charles
-
It was just a heads up and another resource you might find some useful code from.
BTW, It looks like someone ported Jose's editor/IDE to FreeBASIC. That's much closer to home and may be worth including in the O2 distribution as an alternative IDE.
-
My plate is full at the moment. I wonder whether it can be configured to work with Oxygen in its present form. Any Volunteers? :)
-
Sounds like something Aurel would be good at.
-
Hi all
what about Sphinx C-- http://www.goosee.com/cmm/ (http://www.goosee.com/cmm/) or http://c--sphinx.narod.ru/indexe.htm (http://c--sphinx.narod.ru/indexe.htm)
i really liked it very much , but it is very old and has no development.
here was my first approach
/***************************************
* Sphinx C-- *
* *
* TimerTest demo By Emil Halim *
* 26 / 9 / 2011 *
***************************************/
#speed
?useMMX
#pragma option w32 //create Windows GUI EXE.
#pragma option OBJ //create OBJ file
#pragma option OS //speed optimization
#pragma option J0 //no startup code.
#include <Windows.h>
#pragma option ia // allow inline asm
#pragma option LST
extern cdecl _printf();
#define printf _printf
int strlen1(char* pStr)
{
EAX=0;
while(byte *pStr !=0 )
{
pStr++;
EAX++;
}
}
// *** SSE2 version from MASM forum***
int fastcall strlen4(EAX)
{
EBX = EAX ; // get the string pointer
LEA ECX, DSDWORD[EAX+16] // save pointer to string, on par with eax after first loop
EAX &= 0xFFFFFFF0; // align for use with SSE2
@shiftOK:
XORPS XMM0, XMM0 // zero xmm0 for finding zero bytes
@a1:
PCMPEQB XMM0, DSQWORD[EAX] // ---- inner loop -----
PMOVMSKB EDX, XMM0 // set byte mask in edx
EAX += 16; // len counter (best position here)
TEST EDX,EDX
JE a1
if(ECX<=EAX) goto a2;
ECX -= EAX; // get difference, and cancel "misalign flag"
SHR EDX, CL // shift invalid
SHL EDX, CL // bits out
JE shiftOK
@a2:
BSF EDX, EDX // bit scan for the index
SUB EAX, EBX // subtract original src pointer
LEA EAX, DSDWORD[EAX+EDX-16] // add scan index
}
char* testStr = "SPHINX C-- is so easy (an intermediate position between Assembler and C)";
qword EAX_EDX_;
main()
int i;
{
_start:
SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS);
rdtsc
EAX_EDX_ = EDX:EAX;
strlen1( testStr );
rdtsc
EDX:EAX -= EAX_EDX_;
i = EAX;
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
printf("time is %i", i );
MessageBox(0,"","",0);
}
here was the link in fasm http://board.flatassembler.net/topic.php?t=13432 (http://board.flatassembler.net/topic.php?t=13432)
so can we see C-- features ported to OxyGen Basic ? how knows !!!!
-
I Liked C-- a lot back in the days.
It's a bummer that the open source version is still from Peter Cellik, when Michael Sheker took it and transferred into the 32bit world and added more capabilities he never released the sources.
Another project gone south...
-
BTW: the two C-- projects mentioned in this thread are not compatible...