On Mon, 18 Jun 2012 18:22:34 +0200, Matt Diesel wrote: > Sorry, forgot to post the code: > > http://pastie.org/4109337 > > Is there no way to edit posts?
A couple of observations: - According to the D style guide (http://dlang.org/dstyle.html), you should prefer to capitalize class and struct names, constants, and template parameters while starting functions and variables lowercase. Your code betrays your C# experience (I was very similar for a long time) in that you capitalize your method names. Obviously this is a more subjective thing, but your code will blend better with the standard library if you follow the guide. - Read up on ranges. I've written a number of lexers in the past few years in D and the lazy range idiom works really great for this use case. The basic idea is to model the lexer as a range of tokens which the parser (or anything else) can consume. Turns out you can composite a parser, syntax highlighter, etc. with map/reduce and some help from std.functional. The result is super flexible and can potentially be parallelized (your mileage may vary). Overall your code was pretty easy to follow and seemed fairly well written.