"Andrej Mitrovic" <andrej.mitrov...@gmail.com> wrote: > The cool thing about D is that with a little bit of string magic you > can make your own DSL's. Here's a rather hardcoded and superficial > example, but for this simple case it works: > > http://pastebin.com/Xkghv1ky > > Of course you'd need to build your own little DSL string parsing > functions and use regex instead of hardcoding it like that. But all > kinds of syntaxes are possible.
You are right. I tried making one. It parses things like sum !(q{ i=0:10; i * sum!(q{ j=0:10, j!=i; i*j }) }) http://pastebin.com/mQaKXaYY - But it doesn't work because not being CTFE friendly, and also syntax parser is ugly because I am not strong at syntax parsing. Note that creating good syntax parser in CTFE is rather hard, especially for complex syntaxes like of D expressions. Oh, if CTFE could: 1) run external process 2) do file i/o 3) use dynamic libraries This would be much much simpler, but I guess it will not. This features also has safety issues, but D is system language, not browser one.