Hi Miguel... We have been working for the last few years on an object-oriented language based on C at Ecere, called eC. Perhaps you would be interested to take a look? The whole code base is BSD licensed. See http://www.ecere.com/ . So far it uses C as an intermediate language and then run the code through a C compiler. It works great with both GCC and TCC.
Cheers, Jerome On Thu, Mar 11, 2010 at 6:47 PM, Míguel <[email protected]> wrote: > Hi! > > I was thinking on writing (or modifying) a C-like compiler with some > custom object-oriented extension (different than C++ ones) and some > other ideas. > > But, to be honest, I don't have enough coding level to write or modify > a compiler. > > So I though perhaps someone is interested in something similar to what > I'm thinking, and this could be a good place to find people like that. > > I'll show you what are my ideas with code examples, in case anyone is > interested about it. It's only a sample, more additions are probably > needed. > > As none of you are probably interested, let me apologize for posting > it, but I had to try luck! > > ---------------------------------------------- > > Classes Declaration > --------------------- > > class myclass { > property { > // Private properties > private long e, f; > private word g, h; > > // Read-write properties. > public string text1, text2; > > // Read-write property with property set. > public string text3(nvalue) { > text3 = nvalue; > // Additional needed code here... > } > > // Read-only property. > readable string text4; > > // Write-only property. > writable text5; > > // Write-only string with property set. > writable string text6(nvalue) { > text6 = nvalue; > // Additional needed code here... > } > } > > event { > void keydown(byte keycode, byte mods); > void click(dword x, dword y, byte button); > } > > // Operators (not all of them are show in this example). > myclass* operator=(myclass* right) { > this.g = 10; > } > myclass* operator=(string* right); > myclass* operator+(myclass* right); > myclass* operator+(dword* right); > myclass* operator++(); > myclass* operator*(myclass* right); > > // Private method. > private void method1(long param1) { > // Method code... > return param1; > } > > // Public method. > public byte setfocus(short param2) { > // Method code... > } > > // Class constructor. > init myclass(long i = 10, long j = 13) { > // Constructor code... > } > > // Class destructor. > kill myclass() { > // Destructor code... > } > } > > > > Variable declaration and initialization > ----------------------------------------- > > long* var1, var3, var10; // All of them are pointers. > > // Multiple initialization of objects. > mytype button1, button2, button3 { > width = 100; > height = 20; > enabled = 0; > } > > > Behavior of pointers > ---------------------- > > Pointers behave the same way as normal variables, unlike C. > The term to the right of the equal decides what is assigned to a pointer. > > So, in the following example, x is the content of x, *x is the address > contained by x and **x is the content of x. > In other hand, z is the content of z, *z is the address contained by > z, **z is the address contained by *z, and ***z is the address of z. > > long* x, y; > long** z; > > x = y; // Assign to x the content of y. > x = *y; // Point *x to the address contained in y. > z = y; // Assign z the content of y. > z = *y; // Point *z to the address contained in y. > z = **y; // Point **z to the address of y. > y = z; // Assign to y the content of z. > y = *z; // Point *y to the address > > > _______________________________________________ > Tinycc-devel mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/tinycc-devel >
_______________________________________________ Tinycc-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/tinycc-devel
