September 05, 2006 Invariant grammar | ||||
---|---|---|---|---|
| ||||
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 |
September 05, 2006 Re: Invariant grammar | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Manzana | Ary Manzana wrote:
> 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?
I think the specs are in error, I'll fix them. If you find other such errors, please post them. I agree it is important to fix them.
|
Copyright © 1999-2021 by the D Language Foundation