Open samrushing opened 8 years ago
I've been playing around with modernizing the front end, and I have a good idea here: we can annotate code with s-expressions. This would allow not only file/line/column but types and any other kind of metadata. Watch this space.
the above annotation code is being experimented with (in combination with parser combinators) in the 'gaz' language, lessons from there may be moved here.
Early on when rewriting Irken in itself, I tried adding line/column information to the output of the parser, and then finding a way to propagate that information through the various stages. Without this information, finding the actual source of a type error is a real art form. However, this ended up more than doubling the size/complexity of the code - I'm not kidding. So I ripped it all out.
An idea that's been bubbling around for a while is this: make the parser a streaming parser, and do it in a a way that allows the token/sexp consumers access to the file/line/col information 'in real time'. I don't see how this will address the issue with macro expansions, but I feel like there's an elegant answer in there somewhere.