I'm wondering why you used D rather than Rust? Was it just that you were curious about the D language or is there something about Rust that you don't like?
I recently came upon this post and couldn't agree more with it: https://www.quora.com/Which-language-has-the-brightest-futur...
I continue to dabble in Rust, but D is so much more comfortable.
https://github.com/aswyk/oxidation/blob/master/oxidation/src...
Of course, Rust's own lexer is also written in Rust.
ETA: I can't promise my lexer is actually any good... it's really the first non-trivial thing I've written in Rust. But it works ;)
enum MyLanguage {
Var(String),
Int(i32),
Sum(Box<MyLang>, Box<MyLang>),
Let(String, Box<MyLang>, Box<MyLang>)
}
(Apologies if I got a few things wrong; I just mean the general idea)Seems like without a construct like this, you'd have to use subclasses or something similar, which (to me) isn't quite as nice.
alias MyLanguage = VariantN!(<insert types here>);
edit: not that it proves anything, just that "it can eventually be done".