Parsing D Maybe Not Such a Good Idea <_<;

cy via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 14 20:59:43 PDT 2016


So I was toying with the idea of writing a D parser, and this 
happened.

const(/*
				D is kind of hard to parse. /*
			/**/
			int//) foo(T//
			) foo(T//
						)(T /* I mean,
										 seriously
										 */ bar)
	if ( is (T == // how on earth do they do it?
		 int) ) {
		return
			cast /+  where does the function name /+ even start? +/
						+/
			( const (int) )
			bar//;}
			;}
			
void main() {
	import std.stdio;
	writeln(foo(42));
}

I don't think I'm going to write a D parser.


More information about the Digitalmars-d mailing list