Invariant grammar

Ary Manzana asterite at gmail.com
Tue Sep 5 05:27:04 PDT 2006


Hello.

In page http://www.digitalmars.com/d/class.html#invariants it says that 
the grammar of invariants is:

ClassInvariant:
	invariant FunctionBody

And in http://www.digitalmars.com/d/function.html is the FunctionBody 
specification:

FunctionBody:
	BlockStatement
	BodyStatement
	InStatement BodyStatement
	OutStatement BodyStatement
	InStatement OutStatement BodyStatement
	OutStatement InStatement BodyStatement

This means that possibly one could write such statements:

invariant body { }
invariant in { } body { }
invariant out(result) { }

However none of this compile under DMD 0.166 (inserting them in a class 
definition, of course).

Are the specs wrong, or instead of FunctionBody it should be a 
BlockStatement? I think it should be a BlockStatement.

I've found some other "errors" in the grammar, but I don't know if they 
are important (I think for people who want to implement a compiler or 
build an AST this stuff is important). Should I send them too?

Ary



More information about the Digitalmars-d-bugs mailing list