A Catspeak to Gamemaker VM bytecode Just-In-Time compiler.
This project is more of a prototype than anything, please do not use in production.
This repo contains a slightly-modified version of the Catspeak test suite by katsaii.
At this time, this project only supports Windows VM exports.
Simply set your codegenType to JITSpeakCompilerWrapper:
var env = new CatspeakEnvironment()
env.codegenType = JITSpeakCompilerWrapper
// compile and run Catspeak scripts like normalYou may also use the global JITSpeak struct directly, which will use the default Catspeak global environment to compile your code:
var ir = Catspeak.parseString(@' "Hello from JITSpeak" ')
var func = JITSpeak.compile(ir)
show_message(func()) // Hello from JITSpeakYou can tweak the settings used for compilation by creating and using a new JITSpeakCompiler yourself:
var env = new CatspeakEnvironment()
var ir = env.parseString("thisVariableDoesntExist")
var config = new JITSpeakConfig({
errorOnMissingGlobals: true
})
var compiler = new JITSpeakCompiler(env, config)
var func = compiler.compile(ir)
try {
show_message(func()) // Error - Variable thisVariableDoesntExist not set before reading it
}
catch (e) {
// Changed my mind, let's not do that
compiler.config.errorOnMissingGlobals = false
func = compiler.compile(ir)
show_message(func()) // undefined, like in Catspeak
}The default values for each option can be found in the JITSpeakConfig GlobalScript.
JITSpeak supports a majority of Catspeak functionality, however some features are either unimplemented at this time or incomplete.
Unimplemented Features:
matchexpressionscatchexpressions- Infinite loop/recursion timeouts - you shouldn't be using this on untrusted code anyway.
Partially supported features:
withloops - simple loops work, mileage may vary with more complex logiccatspeak_get_index- requires theallowCatspeakIndexingconfig option. Currently, this breaks the self/global getters and setters when enabled.