On Sunday, 6 September 2015 at 23:40:58 UTC, anonymous wrote:
On Monday 07 September 2015 00:37, cym13 wrote:
There already is a kind of "code string":
interpret(q{
var a = 2;
var b += a;
});
It doesn't do any kind of syntax check, but there again how do
you want to have syntax check for any language? The D compiler
is a D compiler, it can't support js syntax or whatever.
There's a very basic syntax check: Token strings (q{...}) go
through tokenization. Compilation fails when the contents
aren't valid tokens. For example, q{'} fails with "Error:
unterminated character constant".
That's not considered as syntax check - that's an earlier stage
of the compilation process called "lexical
analysis"(https://en.wikipedia.org/wiki/Lexical_analysis)