             {type: 'X'}
           else
             v = vars[name]
-            assert v, "Symbol '#{name}' referenced before assignment"
+            if not v
+              throw new CompilerError node,
+                "Symbol '#{name}' is referenced before assignment."
             v.used = true
             v
         when 'lambda'

            h = [{type: 'F'}]

          if h[h.length - 1].type is 'F'
            assert h.length <= 1, 'Trailing function in expression'
          else
            # Apply monadic and dyadic functions
            while h.length > 1

          t1 = visit node[1]
          for c in node[2...] when c isnt null
            t = visit c
            if t.type isnt 'X'
              throw new CompilerError node,
                'Only expressions of type data can be used as an index.'
          t1
        when 'expr'
          a = node[1...]
