The content and motivation of this talk is based on a talk by Rob Pike I stumbled upon on youtube. I also found the slides. I also found a blog post by Eli Bendersky taking the aforementioned talk as a basis for a solution in Python.
So I watched the video and that it was a kinda cool idea, also as a chance to highlight Go’s features nicely. But I didn’t want to dig further for the source code nor was I particularily interested in the exact syntax and semantics of the template engine mentioned in the talk. What I was going for instead was a very simple toy implementation of a potential template engine very loosly influenced from what I saw on the slides, just to get a feel for the idea and Go itself.
So without much more talking here comes the code. As already mentioned above a lot of it is based on Rob Pike’s work. I just filled in some gaps here and there to make the the lexer fully working. In the end follows a little script that tests the library.