init lex and main
added some basic states, thanks rob :)