fully function lexical analyser with a file input&&output