Walter Bright wrote:
Sean Kelly wrote:
I've found that once I created one lexer it could be re-used pretty
easily for other languages too. And recursive descent parsers are
trivial to write. It may be overkill for command-line parameters, but
for anything remotely structured it's generally worth using.
When I was looking into parsing date strings, I thought it would be much
easier if I adopted a lex/parse style approach. The result is in
std.dateparse. The payoff is I've had very little trouble with it.
It's a shame that this kind of lexing/parsing seems to need gotos. I
always feel guilty if I put a goto in my code. (Guess I've had too stern
teachers, or something...)