first draft lexer
fixed a few issues and wrote a real main routine