[gameprogrammer] More scripting engines

  • From: David Olofson <david@xxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Sat, 24 Apr 2004 16:25:58 +0200

Just had an idea. (Probably not a new one, though I haven't seen it 
before myself.) I was going to have these "multilevel" break 
statements, but I don't like the "break <n>" form, where you have to 
explicitly specify the number of levels you want to jump. (Wrap a 
loop in an extra loop forgetting to adjust your breaks, and weird 
things start happening...)

So, if figured I'd name the nesting levels instead, something like 
this:

        while something
        outmost
        {
                while something_else
                {
                        check some, stuff;
                        if all_done
                                break outmost;
                        if nope
                                break;
                }
        }

where 'outmost' {...} would be a named scope. (A {...} delimited block 
is a statement, so I can just add NAME '{' block '}' to that grammar 
rule grammar.)

Another syntax variant:

        while something
        {
                nestlevel outmost;
                while something_else
                {
                        check some, stuff;
                        if all_done
                                break outmost;
                        if nope
                                break;
                }
        }

This was my first thought, but I don't quite like it. I'm not totally 
happy with NAME '{' block '}' either though.

If anyone has some interesting ideas for the syntax, I'm all ears. :-)


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---


Other related posts: