Closed mantkiew closed 12 years ago
It would be, however, nice to have the one-liner notation:
abstract A
B, C, D : A
Is it a bug? No one said that clafers must be declared in new lines. I would say that what the translator generates is what I would expect it to generate. BTW, there is no 'extends' keyword anymore.
Hmmm. I don't know. I had an old model with "extends" and that's how I discovered this "feature" :-) I remember it used to be a syntax error.
I just updated the tutorial - among others I added a section about desugaring and added some rules about declarations that need to be in new line each.
Please have a look at "Clafer a bit more precisely" and "Desugaring".
http://gsd.uwaterloo.ca/node/310
I put this example
A
B [
...
]
as incorrect because you don't know what is the context of the constraint.
How about
A B
C
should it be the same as
A
C
B
or
A
B
C
?
Currently, it's desugared to
0 .. * c1_A : clafer 1 .. 1 { }
0 .. * c2_B : clafer 1 .. 1 {
0 .. * c3_C : clafer 1 .. 1 { }
}
I'd say we should stick to one declaration per line. And introduce special convenience operator ; or | so that I can say
A
xor B
C ; D ; E
Ok, the above argument is good enough.
I tried to fix this issue by improving the grammar but the solution didn't work. Probably there is an issue with BNFC. I'm not going to spend more time on this problem now.
won't fix.
Clafer v0.1.21-12-2011
Desugaring the following incorrect model
produces an incorrect model
but the compiler should produce a syntax error.