Worked on hand written lexer a bit.

It now works on a simple test case - without $ at the end :)
Needs more testing, however...