samrushing / irken-compiler

Irken is a statically typed variant of Scheme. Or a lisp-like variant of ML.
http://nightmare.com/rushing/irken.html
BSD 2-Clause "Simplified" License
209 stars 17 forks source link

file/line/col: streaming parser, transformer, etc.... #17

Open samrushing opened 8 years ago

samrushing commented 8 years ago

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.

samrushing commented 6 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.

samrushing commented 5 years ago

the above annotation code is being experimented with (in combination with parser combinators) in the 'gaz' language, lessons from there may be moved here.