I'm working on a graphical MUD, and I'm thinking about making a scripting (or other meta-) language that will allow a super user/world builder to create a script to attach to an item. When a user uses the item the script is "run".
I think I know how I'm going "run them" and I have an idea about what the language looks like, but I'm having trouble figguring out how to parse the language fast and effeciently. I'm thinking I can parse the language into an array of "actions" when the script is added/loaded -- and then when the action occurs, perform it. This means that the JVM will have a bunch of loaded scripts ready to run, even if they aren't used (or used once) and then I'm using a lot memory needlessly -- but if I reread/parse the script when actions happen, then I am taking too much CPU time when an action is performed.
[plug=shameless]
[/plug]
I think I know how I'm going "run them" and I have an idea about what the language looks like, but I'm having trouble figguring out how to parse the language fast and effeciently. I'm thinking I can parse the language into an array of "actions" when the script is added/loaded -- and then when the action occurs, perform it. This means that the JVM will have a bunch of loaded scripts ready to run, even if they aren't used (or used once) and then I'm using a lot memory needlessly -- but if I reread/parse the script when actions happen, then I am taking too much CPU time when an action is performed.
[plug=shameless]
[/plug]