r/Compilers • u/Emergency_Ad119 • Aug 15 '26
Taking whitespace lightly is technical debt
https://kushagrarathore002.medium.com/every-tokenizer-tutorial-i-read-told-me-to-throw-away-the-whitespace-ac5ab75e89faI have created a programming language Flow-Wing (it can support static and
dynamic types at the same time). When I started its initial development I was
ignoring the white spaces because for the compilation I never needed the white
space, but years later when I needed to support the LSP or formatter (white
space / comments) I had to make significant rewrites, and this article below is
about that. Take a read.
GitHub: https://github.com/kushagra1212/Flow-Wing
Website: https://flowwing.frii.site/ (runs on Flow-Wing)
Happy to answer questions. Do give a star on GitHub to support.
2
u/-Memnarch- Aug 16 '26
My tokens have their line and lineoffset, so whitespaces are reproducable.
1
u/igors84 Aug 16 '26
Interestingly, Zig formatter is working with tokenizer that just skips whitespace and comments, but it is accomplishing that by sometimes looking directly at the source around the currently processing token.