C-Sic

Miscellaneous Forums/General Discussion/C-Sic

Hi all,

Just wanted to post something I was working on for fun. It's a kind of language translator. It takes a basic kind of dialect (much akin to Blitz, and translates it into c++).

So if the look of C++ makes you sick, I give you C-Sic.



Heh heh.

It compiles using MinGW and works quite well, albeit a bit limited atm.

cool. How far are you going to take this?

cool. How far are you going to take this?


It's been a bit 'Here and there' over the last few weeks.

I'd like to get to the point where I could write a proper project in it.

At the moment the basic parsing works quite well. It understands, functions, if statements, select statements, structure and unions, but no classes yet. My C++ is a little rusty after all these years, so I'm re-learning it as I go :)

So far I haven't hit anything I can't handle, but am working my way through c++ tutorials, reverse engineering the translator to be able to create the examples as I go.

I would like many of the complexities to be handled by the editor (includes etc.) to keep the actual code as clean as possible. I'll post a working demo here once I have something worth playing with.

I to am learning C++ again, basically I want a set of libraries that are as good as Max so I can write me own System Shock 2 game in it :D

Currently I am wondering how to deal with case sensitivity. I wanted to make it case insensitive. Currently I make all identifiers lower case, but wondering how this will jibe with header file. Any suggestions?

How do you handle variables or functions that exist in C++?

i.e. if you were to create a variable called cout.

How do you handle variables or functions that exist in C++


Currently I don't. The idea is to get C++ without the faffy syntax. Cout is under the std namespace (if I recall). How it works is to look for basic contructs and replace these with C++ constructs. Anything not recognised is passed to the C++ output. This would allow 'Pure C++' blocks to be marked out by:

BeginC

EndC

Or something like that. Anything between these delimiters would be passed to the C++ output unaltered.

Of course if you couldn't link to libraries or use external headers, then the system wouldn't be much use. This is why I am concerned about the case thing.

Would pre-processing the header files and making all the identifiers lower case solve the problem do you think. Are external functions case sensitive?

I didn't actually mean that you were writing in C++ just, what would happen if you had a variable or function that coincidentally exists as a C++ function?

it would return the same error that the c++ compiler would pass back. I tried it and it complains that cout cannot accept the << binary operator. :/

So no smart aliasing 8D

if someone wanted to draw an image they would still have to learn opengl though right?

Thats why I stick to blitzmax - also good collision commands

if someone wanted to draw an image they would still have to learn opengl though right?


Depends really. It could interface with the Blitz3D SDK or any other libraries I expect. It seems we'd all like something as fast as C++ with all the power it gives us, but without the complexity of the language.

To some extent it makes sense to have a 'inbetween' compiler to hide the complexity, while letting the back end c++ compiler take care of the optimisation.

As I said, it a fun side project at the moment :)

Hey, make it translate BlitzMax into Objective C ;-0