Sign in to follow this  

Unity Script Languages: What are the basics?

This topic is 4480 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

I'm going to code a robot friendly script language, that is not designed for speed or great flexibility, but for sheer compiled size. In other words, I want the compiled programs to be small. I wanted to know how much you can reduce a language to it's basic constituints, before it becomes inpractical. I know we all need our if-then-elses, our gotos, etc... Where can I find info online regarding this subject? [ Visit My Journal ]

Share this post


Link to post
Share on other sites
Assuming your robot runs it's own bytecode, then the more bytecodes you have the smaller your code can be. For example; you could implement an if else with jmp and cmp, in several instructions, or with a more specific single instruction.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
http://www.muppetlabs.com/~breadbox/bf/
???
BF code has few instructions, but it isn't by any means small. At the very least, if you use BF, you should probably allow some kind of run-length encoding, such as having bit patterns 0000-0111 be the various instructions, and 1000-1111 be a instruction + repetition pair (4 bit instruction, 4 bit repetition count for counts of 0000=2 to 1111=17). Even then, I'm not sure it's optimal compared to more traditional instruction sets (especially if you make speed or flexibility secondary considerations instead of just forgetting them).

Share this post


Link to post
Share on other sites
Look into Forth, most implementations generate code smaller than Assembly. You can check out pbForth, an implementaion for Lego robots: http://www.hempeldesigngroup.com/lego/pbForth/homePage.html

Share this post


Link to post
Share on other sites
if your interested in writing your own, then Alex Varenese's "Game Scripting Mastery" is an excellent introduction to the topic of both high-level and low-level compiler/assembler theory, as well as virtual machine design and implementation. That comes highly recommended from me for what thats worth :-) The obvious choices for "drag and drop" scripting languages that can be inserted into your existing project are probrably tcl, Python or Lua.

Share this post


Link to post
Share on other sites
The best strategy seems to be to design an assembly sort of language that you can convert into byte code (via an assembler), and then write a high-level language compiler (optional) that can compile from high level constructs down to your low-level assembly language. This way you can get the option to write in high or low-level scripting language, and also if your not getting the speed you want from your compiler, you can always do it by hand :-) You can write out a byte per operation more than likely (you wont need more than 255?), with space for a few operands per operation which can be variable by writing out another byte. With regard to online reading, you can get e-books of the dragon book, which goes into compiler design, hash tables, etc. All the good stuff you'll definately need, but that book I mentioned is definately worth getting out the library or buying.

Share this post


Link to post
Share on other sites

This topic is 4480 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