Sign in to follow this  

Variables at bytecode level

This topic is 3869 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does it make sense to have variables with bytecode? It didn't really seem necesary to me until I came to 'for' loops. Apart from that, I think I'm fine without them. Besides, they sound like kindof a pest to create and put on the stack.

Share this post


Link to post
Share on other sites
A programming language, even a simple Bytecode interpretter, isn't much use without variables of some kind. If you're intending the bytecode only as a simple command language then you can get away without them.

Really they're very simple to handle. I wrote a simple command language for one of my early school projects (A text adventure) that simply had access to an 8k array. This allowed for enough control that the entire game was in the script, away from the engine. Those were essentially "globals" in terms of the script. There was no need for local variables, but they would have been easy enough to add.

I presume that you've got a return stack if your bytecode allows for function calls or any kind of looping structure. Adding a general-use stack should be simple.

Share this post


Link to post
Share on other sites

This topic is 3869 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this