News for hackers. Stuff that matters.
Re:How Microsoft rewrote its C# compiler in C# and made it o... by Rusky on Wednesday February 12, 2020 @11:41AM (#22310293)
Many (if not most) ASTs, especially in batch compilers, do not preserve comments, whitespace, or even all of the actual syntax. Even the diagnostics information you're referring to are insufficient to reproduce the whitespace.

Further, what Roslyn does is quite interesting even on top of preserving all of that. It does so in a way that lets it incrementally re-parse parts of the program without touching the rest- including position information for the rest of the file after the change, which has all shifted to match.

None of this was standard practice anywhere when Roslyn was designed, though it's starting to be picked up in other projects since.

There are no comments on this comment yet.