mozart/mozart2 — pull request #193 by kennytm (2014-06-04 22:30:10+00:00)
Title: Make `ozc -g` and stack traces work

The sole purpose of this commit is to make `ozc -g` stop crashing and generates line number information that can be recognized in a stack trace.

The changes here are:

1. Defined 5 opcodes emitted when `ozc -g` is used.
2. Update the current line number when we encounter the `debugEntry` and `debugExit` opcodes. The other three are currently no-op.
3. The line number info will be stored into each StackEntry (which is responsible for most changes in emulate.cc)
4. Added a test case to ensure the line number reported in the exception is correct. Since this test case requires the `-g` flag, it is compiled separately unlike its cousins.

Known issues:

1. Using `-g` with list comprehension still crashes the compiler as it requires changes in Unnester.oz beyond my knowledge.
2. Exceptions raised from unification failure will yield wrong line number because the `debugEntry` instruction is not generated for this statement.
3. Doc/Instr mentions "Neither of ..., localVarname or globalVarname may ever be executed by the emulator." but currently `localVarname` and `globalVarname` are generated as opcodes. I don't see how these can be attached to DebugData instead as it is immutable.