Home | Reviews | GUIpedia | Forum | Fun500

Jasonhow hard will it be to implement
yo the blogs been quiet for a few months. so im making an interpreter, an operating environment. the syntax i've designed is really complex but if i make a good interpreter, people WILL make programs command(exression,fakearray[variable]."hello boys") {we();support();clauses();boys();}; anyway just a retarded example. is this too hard for one to implement? am i setting the bar too high?
2011-11-113:30 AM

RetroMRe:how hard will it be to implement
Are you trying to make a C++/java style interpreter?
2011-11-116:17 AM

JasonRe:how hard will it be to implement
pretty much. oh, and the apps are library driven. i just thought this off the top of my head and it looks pretty flexible. (good to see someones alive and kicking ;P) oh and by the way, "fakearray[variable]" actually means that you can put the output of an expression into code, so here's a better example: a="swap";
[a](b,c); the interpreter will read it as swap(b,c);
2011-11-119:30 AM

pharoahRe:how hard will it be to implement
Looks good. I'm always glad to see advances in GUI scripting languages. As an interesting aside, you'll eventually have to figure out whether to do recursive replacements in the code. For example, what if I do foo([b], c) and [b] is bar([d], e)? You could recursively call your eval() function, but that might not be what you want to do.
2011-11-1312:48 AM

JasonRe:how hard will it be to implement
Yeah, I was thinking of calling the function inside itself, is there a better way? The only problem I could think of is stack overflow?
2011-11-134:35 AM

pharoahRe:how hard will it be to implement
I think calling eval() recursively is your best bet. That's how languages typically do this kind of thing. The only limitation I can think of at the moment is the fact that it could be very slow, depending on how you do it. If you want people to be able to make calls like [a](foo, bar), then you'll probably end up doing something where you splice the result of eval(a) into the string where [a] was, which means that you have to reallocate and copy the whole string each time you do this. Another thing to pay attention to is how you're storing your variable name -> value mapping. You'll want some sort of data structure that doesn't require you to search every key in the worst case. Hash tables and skip lists come to mind as being reasonably easy to implement. Let me know if you want an explanation of these.
2011-11-1311:35 AM

JasonRe:how hard will it be to implement
cheers for the advice. ill make an interpreter, just to test the syntax in the week. stay tuned ;)
2011-11-136:18 PM


2021 Brandon Cornell