AST like coding syntax. Easy upgrade!

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 6 16:40:57 PDT 2015


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".


More information about the Digitalmars-d mailing list