script compiler question
I've made a simple script language for a part of my game... I also made a simple interpreter for running the script and it works nicely. But the interpreter runs alittle slow so now I need a multiplatform script compiler. Making one myself would be a really time comsuming process.
I could convert my script into C code and then save to a file and then run a regular compiler on it...but that seems like a round about way to do it. What i would like is to incorporate a compiler(like steal the guts from an opensource compiler) into my program and take my already parsed script code(ie converted into my own interpreter instructions) and send them to the compiler and have it convert those into machine code for the current platform. Then return a pointer to the memory block that has the finished product so I can either run it, or save it to the disk to use later.
Should be simple right?
Basically does anyone know of any open source compilers that i could use to do somthing like that? or how i would do it?
Thanks.
[edited by - warpexplorer on May 8, 2002 2:18:52 PM]
The easiest solution would to use java for any multiplatform development. To me, I would get very complicated if your main program shells out to compile and interpret your scripting language stuff. The compiling alone would be the bottleneck because you are compiling and executing every one of your scripting commands... but any multiplatform project seems to be slow.. from the translation of the code to it''s native executable format
The nightmare travels across the cosmos with his burning mane. The trail of ash that is produced.
?Have a nice day!?
quote: Original post by warpexplorer
Basically does anyone know of any open source compilers that i could use to do somthing like that?
GCC. Perl can also be compiled, and Python, PHP, Eiffel and many other languages have open source interpreters.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
ummm, my scripting language is... different.... i can''t use any other language out there, because it would defeate the perpose of my scripting language in the first place... I could do a convert, But like i said, that seems like a round about way to do it. I suppose i could try to take apart gcc, perl or something...but im guessing that they werent designed to be used the way i want to use them.
Anyone know of anything that was actually designed for use with other languages?
Anyone know of anything that was actually designed for use with other languages?
quote: Original post by warpexplorer
Anyone know of anything that was actually designed for use with other languages?
GCC uses an intermediate language format to which all the other "compilers" serve as front ends. You could write your own script interpreter-compiler as a GCC front end.
Of course, the real question is what kind of design do you have that isn''t fast enough when interpreted? Either your interpreter is shoddy, the language is crippled or you''re trying to do too much in the scripting language - stuff that should be done in the main engine. People have successfully embedded Lua, Python, JavaScript... in their game engines. What''s wrong with yours?
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Yeah, the gcc front end looks like my best option so far.
My interpreter runs pretty good actually, But it just wont work for what im going to be doing with it eventually(trust me, it wont). But a compiler will work perfectly
anyone got anything better than gcc?
My interpreter runs pretty good actually, But it just wont work for what im going to be doing with it eventually(trust me, it wont). But a compiler will work perfectly
anyone got anything better than gcc?
How about LCC or EiC??
http://www.cs.princeton.edu/software/lcc/
http://www.kd-dev.com/~eic/
/*
* Email | C++ rules & recommendations | Lex & Yacc
* Virtual Terrain | Funtion pointers | Compiler techs
* Compiler & Contruction tools | Real Programmers
* Python | OpenGL | LCC Win32 | Tom''s Hardware
*/
http://www.cs.princeton.edu/software/lcc/
http://www.kd-dev.com/~eic/
/*
* Email | C++ rules & recommendations | Lex & Yacc
* Virtual Terrain | Funtion pointers | Compiler techs
* Compiler & Contruction tools | Real Programmers
* Python | OpenGL | LCC Win32 | Tom''s Hardware
*/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement