Open darkf opened 8 years ago
This may require a redesign of the parser which currently modifies the code with .replace()
, .trim()
, and " "+
and thus loses track of the original token offsets.
Speaking of which, I'd suggest working towards a simple recursive parser/tokenizer that encodes the AST in the language's own data structures. I don't know if k6 does this, but I quite like the near-homoiconicity of older versions of k/q through -5!x
and -6!x
.
Looking forward, I agree- the parser has grown some unnecessary scar tissue and a rewrite could both provide useful new features and permit simplification of the interpreter.
I would recommend holding off on this, though, until we have most of the k6 changes solidified.
It is a ubiquitous feature to many compilers/interpreters that error messages report the location of the error, e.g. "Type error: line 1, column 6", but oK currently does not.
K6 also has a helpful feature to point a caret at the location of an error: