Version 0.4.0: Lexing implementation, bug fixes

Implemented an abstract lexing facility and fixed minor bugs.