D should disallow forward references

Robert Fraser fraserofthenight at gmail.com
Tue Aug 25 18:57:52 PDT 2009


Stewart Gordon wrote:
> Have you written a compiler for a superset of C in which arbitrary 
> forward references are allowed?  How did you do with overcoming the 
> difficulty that is C's context-sensitive grammar?

C (minus preprocessor, of course) is only context-sensitive with regards 
to casts AFAIK. Since casts are always expressions, you can rewrite 
parenthesized expressions to casts (or vice versa) in a second pass but 
still allow forward references. Java and C# are also context-sensitive 
as far as casts go.



More information about the Digitalmars-d mailing list