Created
October 6, 2014 14:25
-
-
Save API-Beast/7e1ad1ab5fec1841c4ff to your computer and use it in GitHub Desktop.
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
// 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); | |
for(string script : scripts) | |
{ | |
Fragment script = p.loadFile(script); | |
// We don't execute it, we just put all the symbols into the global namespace. | |
env.merge(script.locals()); | |
// At which point would we do verification & optimization in this model? | |
// I honestly have no idea. | |
// Maybe we should store all the debug information and do it in the VM. | |
} | |
// And finally the lightweight VM we can construct whenever we need it. | |
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