My ideas for compiler source spans
gist.github.com·5d
🔗Functional Compilers
Preview
Report Post

The problem

Information is lost when going from concrete syntax to AST, and information also gets lost when doing operations on that AST.

So I have a novel approach to compiler source spans that’s been on my mind for years. I haven’t exactly implemented it, though code for it does appear in my mess of dhall-purescript, which is my project to create an interactive structural editor plus dhall implementation. But it isn’t exactly integrated into producing useful output yet.

Anyways.

The Solution

My opinion on compiler source spans is that:

  • Every AST node should be associated with at least one source span.
  • Every AST node should be able to have more than one source span.
  • Source spans should track not just the actual…

Similar Posts

Loading similar posts...