By Paul Weijtens
Version: Gamemaker Studio
Download: zip archive 1.5 MB
License: GNU General Public License
Source: google code
Downloads to older versions may be found at the google code page
Mathematical Logical Parser is an extension/scripts which enable you to execute external user-inputted code without relying on the hideous execute_string, or external dlls (such as for LUA). The perfect use of this would be for an in game console. The code from the console would then be parsed by this parser.
Another use is in user-created maps. In such a map there might be certain triggers, which are programmed by the creator of the map. The execution (and condition checking) of those triggers is a perfect application of ML parser. Other implications range from a calculator, to analyzing data.
Version 2 is a direct successor to MLP_Parser 1, a version for Gamemaker 8.1. The goal hasn't change since.
For those who are still unsure what this can do, a small test should convince you!
ML Parser rests on 2 big pillars which shaped the engine
ML Parser is robust
This means that ML Parser is safe from errors, and errors on the end user part are handled gracefully without breaking the program. This is an huge advantage over execute string: as typos are always possible when adding a console.
ML Parser is safe
This means that code executed by ML Parser is "safe". It does exactly as much as you allow ML Parser to do. And there is no possibility to do malicious things such as code injection. Or retrieving your valuable game resources in another way. You as programmer have full power over which variables are editable/readable.
Other key features
- based around the Shunting yard algorithm for fast execution
- independent of dlls, so portable to any platform gamemaker is working (from iphones to gm4mac & gm4win)
- Complete safe; YOU register the function which can be used, and the syntax checker prevents anything else
- Robust exception handling; If the input expression isn't a valid expression, an "exception" is raised. Not leaking memory and not crashing your program
- Many default operators; over 50 operators defined, 3 categories and a dozen build-in functions.
- easy to extend; you can add your own functions and operators with simple functions
- Compiling Compile once, execute many times. As a rule of the thumb: if you expect to execute an expression more than 1.5 times on average compile it!
The first thing on the list I will add now are probably variables, to allow custom user variables I'd have to reserve another series of keywords. Probably "varreal" and "varstring" will be the keywords.
- Ability to let users define variables & use them
Ability to "compile" but not execute functions(in 2.1)
- Extra user types (references/objects/arrays)
- Ability to optimize compilations
- Added ability to compile & execute
- Added function ML_Interpret() for clarity - and new syntax
- Moved results to their own object (ResObj) that is returned by the functions
- The expression to parse is no longer part of the parser but an argument to the functions
- Some minor (and major) speed improvement by using GM:Studio accessors.
- Small bug fix in operator handling
- Initial release