Cool I didn't know this was a common pattern. I recently saw the same approach implemented in scala.meta [1] - it allows you to view the code as both parsed tokens with all syntax intact as well as more abstracted ASTs which only carry semantic meaning. Someone even built a code formatter called scalafmt[2] like the author mentions.
Its a really cool approach because I think we need to pay much more attention to making more/better structured data from the compiler available to tools.
Its a really cool approach because I think we need to pay much more attention to making more/better structured data from the compiler available to tools.
[1] http://scalameta.org/tutorial/ [2] https://github.com/olafurpg/scalafmt