compiler: rewrote scanner to use own algorithm