if you define Lexer as a reference type there is then no need to use the ref
keyword anymore, your New function (in Nim the convention is to call it
newLexer) would be simply
proc newLexer(input: string): Lexer =
....
and, under the hood, it would return a garbage collected pointer to an heap-allocated object
