I should also mention I've taken some deviations from Sierra script syntax, much of it due to the way the compiler is set up (and requiring compatibility with SCI Studio). It's possible I can make it closer to the original, but only if I don't need to maintain two separate ways of compiling. The more code I can re-use the easier it makes testing, etc...
Anyway, some differences:
- : or ? will be required for selector names. Sierra's code appears to have stuck with this convention anyway, so not a big deal.
- , will be optional (instead of required) when separating selector calls (made possible by requiring : and ? above)
- procedures and methods don't need to be forward declared
- Currently I'm still requiring the "use" statements that Studio syntax uses (

). Sierra didn't have this. As far as I can tell, all classes were in global scope (so they could always be referred to). And procedures required an "extern" statement that mapped procedure names to script/export index pairs, and which was typically included in a header file I think. I'm tempted to try to replicate this, but it might mean maintaining two different code paths for part of the compilation process, and I'm a bit reluctant to do that.
Some possibly irritating things about the Sierra syntax that I *won't* change:
- all operators have to have white space after them:
(++i) -> this is a compile error
(++ i) -> this is valid
- it is *very* strict about parentheses. Unlike Studio syntax, you cannot arbitrarily enclose expressions in parentheses. Luckily this makes it much easier to parse than Studio syntax.
(if (something) 1 else 2) -> compile error, because something is enclosed in parentheses. We think it's a procedure.
(if something 1 else 2) -> valid
(if (== something TRUE) 1 else 2) -> valid, since all expressions have to be enclosed in parentheses
= temp0 6 -> compile error
(= temp0 6) -> valid!
- the array syntax is unorthodox, but I'm not changing that
The Sierra syntax overall is easier to parse than Studio syntax. It's more logical and consistent (and compiles are about 20% faster).