Parse for Dev-c++

Hi, sorry if this is the wrong message board wasn


  • You've got a couple of things mixed up. Firstly Dev-Cpp isn't really a compiler. It's only an IDE that uses gnu gcc compiler.

    That put aside, I don't think what you are trying to do is such an easy task and writing a parser is the least of your problems. In addition to compiling the code with gcc compiler you'd need to get it loaded into memory somehow and then start executing it there which could run into a number of errors plus the compiled code would have to communicate with the original game engine code. Unless of course the game engine's sole purpose is to generate entirely new stand-alone executable program.

    A lot easier solution would be writing an interpreter. You'd only have to parse your own language code into some convenient structure and then call appropriate C++ functions in correct nodes of structure.

    Another approach could be using some pre-made language such as Lua or AngelScript. I'd recommend AngelScript since it's easy to integrate into almost anything and it's probably safer and more tested as well.

    : Hi, sorry if this is the wrong message board wasn
  • Hi, thanks for the respone. I looked a bit more carefully on the bloodshed site and they say they use the MingW gnu compiler, so i went to their site and they give details on how to use it via command line, so at the minute i could use a batch system which will send c++ to the compiler.

    The engine as it stands is basicaly a large DLL (mainly just graphics at the minute the other features aren't in DLL form) and i am able to produce exe files by using a header with the function/classes etc... in and then using the code as it should be. Then from there you use it as a normal DLL including it in the project and away we go. Its a similar set up uto irrlicht etc.. but mines aimed around the windows environment.

    And the parse situation is only an idea at the minute, but basicaly the ending requires setup functors and loops etc.. which allows the engine to run if you will. I was thinking of making the parse fairly similar to c++ syntax and just basicaly inserting the code inbetween the required loops etc... and having various simpler calls etc.. if you get me. So heres sum fake code:

    using namespace bf;

    void doStuff()
    std::Cout<<"hello world";
    int winapi(blah,blah,blah,blah)
    float a = 3.141529;

    function doStuff()
    print "Hello World";

    real a=3.141529;

    then the parser would just convert that code into a c++ file, send it to the compiler delete the c++ file and we now hav an exe... or so i hope lol

    Does this seem reasonably or do you think i should use another method?

    Oh and got a simple GUI for compiler u know of a good method for syntax highlighting? because my method assumes that the first word you put in will be the keyword e.g.
    keyword "hello";

    hello -highlighted
    int a; hello -wont be kinda thing it
    basicaly waits untill the line has finished and scans the line comparing it to the string + i think this method will be very slow when it has to check through many keywords etc...

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!