This post is an attempt to explain the incremental parsing algorithm aretext uses for syntax highlighting. Like the rest of aretext, parsers are implemented in Go for portability and performance. Most people do not consider Go a functional programming language; nonetheless, aretext’s parsers rely on functional programming patterns. In this post, we’ll see how to implement these patterns in pure Go to build parsers that are fast and expressive. Problem Syntax highlighting is a special case...