🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Compiling a script

Started by
5 comments, last by GameDev.net 19 years, 11 months ago
Is there a scripting language or a tool for a popular scripting language, which allows compiling a script to binary and executing it immediately. I know that it is possible with C#, but the framework initialization needs to much time. Are there alternatives? Thank you!
Advertisement
Most of the scripting languages do have that. If you want a C like scripting language, try Small. If you don't care about C likeness, you might try other scripting languages, such as LUA, Python, etc.
I am using Lua for a while, but as far as I know, it compiles scripts to a byte code, which is interpreted at runtime. But I would like to have machine code, which can be runned directly without an interpreter.
Using C# I am able to build a DLL at the runtime of my application, which can call functions of that library.
Oh..
Then try Small, it has a JIT compiler.
Python with Psyco will emit machine code for Python scripts. Off the top of my I head I believe there are Lisp implementations that will also emit machine code at runtime, but I can't recall specific names right now.
Some Java VMs do that too.
It is not possible to completely precompile weak-typed languages (under which category most of the scripting/interpreted languages fall) because final types cannot be predicted. There are some "workarounds" (some are already mentioned in previouse replies) but all of them are runtime solutions. In general Bytecode is the closest you can get to machine code at pre-runtime.

This topic is closed to new replies.

Advertisement