Last active
August 29, 2015 14:07
-
-
Save API-Beast/7cc624b5f4dcbe19bdd4 to your computer and use it in GitHub Desktop.
New ModC Configuration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScriptManager modc; | |
// Environment and Configuration can still be modified by accessing the public member variables in modc. | |
modc.compileAndLinkFile("script.modc"); | |
VirtualMachine vm = modc.prepareVM(); | |
vm.callFunction("Main"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The basic profile of the language | |
// One could for example add additional operators by modifiying it. | |
Config config = BaseConfiguration(); | |
// The script envionment, e.g. which variables/functions are defined? | |
// This is seperate because so we can link different script fragments together. | |
Environment env; | |
// The parser, it only needs to know about the configuration. | |
Parser parser = Parser(&config); | |
Fragment script = p.loadFile(script); | |
env.merge(script.locals()); | |
VirtualMachine vm = VirtualMachine(&config, &env); | |
vm.callFunction("main"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment