Improved Parser

Added checking of file before parsing
Added checking of unnecessary token at EOF