Original Post
it's me again *g i've begun to write an own script engine, this is my thrid approach so far, i didn't like the first two. i've written some simple classes, wich handle all the operations of a script, and execute them, but i have no clue, how i can read out a script and then preprocess the script. i have in mind that some kind of function reads out the script line by line, and then fills my ScriptLine array with the operation it needs to do there, and all the argument this operation needs. this will be usefull, if i want to run the script very often, so that nothing needs to be done when executing this script, except than checking the operation type. how can i parse each line, and find out what needs to be done there? i had some simple grammar in mind, something like: blub = 5+4; blub = var2+3; blub = "i am a string"; SomeFunction( arg1, arg2, arg3 ); perhaps i'll make the language more powerfull, but only when this works. i've already heard of regular expressions, but i am not shure if this would be the right thing for this. i'm shure you can help me with this one :)
struct Argument
{
VarType _type; // Type of the Argument
char *_name; // What Name the Argument has
union {
void *_ptr; // Pointer to it's Value ( in the stack )
char *static_cdata; // Static char array
int static_idata; // Static Integer
float static_fdata; // Static Float
bool static_bdata; // Static Bool
}data;
};
class ScriptLine {
int _type; // operation type
std::vector<Argument*> _arg; // List of Arguments
};