# SCI Studio compatible compiler

Note

This is provided for compatibility with SCI Studio (and earlier versions of SCICompanion. For new games, it is recommended you use the original Sierra syntax: The SCI Compiler.

The script compiler in SCICompanion can use a syntax that is nearly identical to the compiler in SCI Studio. It is more strict, so some things that compile in SCI Studio may not compile in SCICompanion, or may give warnings (this is a good thing). It also generates slightly smaller code than SCI Studio.

SCI Studio script is an object-oriented language with message passing semantics (like Objective-C or SmallTalk). Syntactically, it also looks a lot like LISP (due to the plethora of parentheses).

One difference that will be programmers familiar with C++, C# or java, is that expressions use Prefix notation instead of Infix notation. For instance, to add two numbers together and assign them to a variable in C#, might look like this:

    // C#
    int i = 5 + 6;

But in SCI script it looks like:

    // SCI
    (var i)
    (= i (+ 5 6))

The topics below describe all the various language features and syntax.

- Script version
  - Conditional expressions
  - Constant expressions
  - Exports
- Classes and instances
- Properties
- Procedures
- Variables
- Variable types
  - Number
  - Boolean
  - String
  - HeapPtr
  - Rect
  - Point
- Comments
- Define
- Include
  - Message files and polygon files
- Use
- Strings
- Said
  - Some more examples
- Synonyms
- Selectors
- Send, Self and Super
- Return
- Code block
- Assignment operators
- Arithmetic Operators
  - Addition +
  - Subtraction -
  - Multiplication *
  - Division
  - Modulus %
  - Increment ++
  - Decrement –
- Bitwise operators
  - Bitwise AND: &
  - Bitwise OR: |
  - Bitwise exclusive OR: ^
  - Bitwise shift left: <<
  - Bitwise shift right: >>
  - Binary NOT: bnot
- Relational operators
  - Equal: ==
  - Not equal: <>
  - Less than and greater than operators
- Other operators
  - not
  - neg
- Conditional expressions
  - Differences between SCI Studio and SCICompanion
- If statements
- Switch statement
- While statement
- Do loop
- For loop
- Break statement
- Rest
- Inline assembly
- Object files
  - The object file format
- Accessing an object’s header