re-implement main and lexer