Compiler Errors

There are 77 compiler error messages all covered in the Small manual. Common errors are:

Missing semi colons
The single most common error is that you forget a semi-colon at the end of a line. This will lead to an error such as:
plugin_vote_kick.sma(89) Error [1]: expected token: ";", but found "-identifier-"
You will get used to fixing these very quickly.
Bracket mismatches
These are an nightmare to track down as they can lead to all sorts of different error messages depending on the code around the missing/ extra bracket. You should make sure you indent your code religiously in order to minimise occurrences of these errors. A missing closing } usually leads to these two errors, with possibly more later in the file.
plugin_vote_kick.sma(55) Warning [217]: loose indentation
plugin_vote_kick.sma(55) Error [29]: invalid expression, assumed zero
A missing opening { is often harder to track down as the errors occur on other lines. You'll often get an invalid indentation warning, or this error later in the file:
plugin_vote_kick.sma(203) Error [10]: invalid function or declaration
A missing opening ( bracket will usually result in the error:
plugin_vote_kick.sma(202) Error [29]: invalid expression, assumed zero
A missing closing ) bracket will usually result in one of the following errors, even when an array is not involved in proceedings:
plugin_vote_kick.sma(202) Error [28]: cannot subscript, not an array
plugin_vote_kick.sma(202) Error [35]: argument type mismatch (argument 1)
plugin_vote_kick.sma(202) Error [33]: array must be indexed (variable "x")
The key thing to fixing errors related to bracketing is always recompile immediately afterwards before looking at any further errors. Also, if you are using a text editor with automatic indentation (e.g. textpad, ultraedit or xemacs) and it isn't indenting the way you would expect while typing your source code, this often indicates a bracketing error.
Argument mismatches
When you pass a string in an argument to a function, you have to declare the function argument with trailing [] - e.g.
IsBanned(MapName[]) {
Not doing this, or not using a forward declaration of the function at all will normally lead to the following error on lines that call the function:
plugin_vote_kick.sma(202) Error [35]: argument type mismatch (argument 1)

Compiler crashes

Now Small isn't the most mature language in the world - and the compiler still has a few bugs in it. Sometimes it can't handle the errors in your program and just crashes instead of producing proper error messages. In these situations the best thing you can do is start commenting out code until you get a compiling plugin, or proper error messages. Eventually you will narrow down which line is causing the error.

Some know causes of compiler crashes are:

Duplicate global variable names
If you define the same global variable name twice, the compiler will crash. This can be a side effect if you forget an opening { when declaring a function - e.g.
new a;

func() /* NOTE: Missing { on this line */
  new a;
}
Long variable names
Small only allows 31 characters in a variable name. However, if you declare two variables with names longer than this, and the first 31 characters the same, it will crash instead of reporting that the names are too long.
Missing brackets
In rare circumstances missing or extra brackets can cause the compiler to crash instead of reporting the error message. The only way to diagnose this is to comment out code bit-by-bit until it doesn't crash, and you'll find a missing/ extra bracket in the bit you just commented out.
Missing closing quote characters
If you forget to close a string (i.e. the second " character is missing) on a line that happens to be near the top of a large plugin, the compiler will crash with a "!push assertion" error message. A syntax highlighting text editor should make this problem obvious though.
numargs() weirdness
I've yet to narrow down the precise cause, but the following will crash the compiler. In general, if you using numargs() call it once at the top of the function and store the result in a local variable for future use to avoid problems.
a() {
  if (numargs()) {
    return 0;
  }

  if (numargs()>0) {
  }
}