D grammar overhaul
Rainer Schuetze
r.sagitario at gmx.de
Sat Apr 2 01:11:16 PDT 2011
Before going into details with the grammar, I'd like to clarify one
thing regarding the lexer, that also has some influence on the grammar:
Do we want to allow spaces and comments between these tokens?
- ! in
- ! is
- extern ( C ++ )
- @ Property (safe, trusted, disable, etc)
here is some example code which also shows an ambiguity introduced by
combining these from seperate tokens:
extern(C
//
++) void foo();
@ /* comment inside
property */ safe int bar() { return 0; }
void main()
{
int[int] a;
struct S { int x; }
S s;
int b;
if (1 ! /* still an infix operator? */ in a) {}
if (null ! /* still an infix operator? */ is null) {}
// if (s.x !in a) {} /* does not compile:
http://d.puremagic.com/issues/show_bug.cgi?id=5785 */
if (b !in a) {} // but this compiles!?
}
Trass3r wrote:
> Original discussion forked in the D grammar thread, so I'm opening a new one for this specific issue.
> The D grammar is in dire need of an overhaul.
>
> I suggest we discuss changes here and then put everything into github to issue a pull request once everything's done.
> I already forked the d-programming-language.org repo to get started by fixing some mistakes. Hereafter I list some issues that come to my mind.
>
More information about the Digitalmars-d
mailing list