[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CoFI] Ambiguity in CASL concrete syntax



There is a fundamental ambiguity in the concrete syntax [proposed for]
CASL v0.99.  Looking at the concrete syntax:

QUAL-PRED-NAME  ::= pred PRED-NAME : PRED-TYPE 
                  | ( pred PRED-NAME : PRED-TYPE )

QUAL-OP-NAME    ::= op OP-NAME : OP-TYPE
                  | ( QUAL-OP-NAME )

one has the possibility of leaving out the ()'s in predicates and operations.
Due to this fact the following code is ambiguous:

        spec TryOut = 
                axiom x = x op t : test         
        end

it is:  x = x   op t : test   
        |____|  |_________|
       FORMULA   SIG-ITEMS              

or 
       x = x   op t : test   
           |_____________|
           MIXED-TERM   
       |_________________|
        FORMULA

My proposal is:

QUAL-PRED-NAME  ::= ( pred PRED-NAME : PRED-TYPE ) 
                
QUAL-OP-NAME    ::= ( op OP-NAME : OP-TYPE )
                
so that the ()'s in QUAL-PRED-NAME and QUAL-OP-NAME are not optional.

best regards
Bjarke

[In fact Bjarke's proposal is essentially what was proposed in Bremen.
In the draft v0.99 syntax, however, I followed a later suggestion to
make the parentheses optional - without noticing the ambiguity (which
Bjarke discovered while testing the parsing of examples using ASF+SDF).

It seems that the ambiguity would disappear if the optional ";" at the
end of lists of items was made obligatory (or if mixfix notation was
prohibited... :-).  But since we hope that qualified names will occur
very seldom in practice, I propose that we adopt the above proposal,
making the parentheses around qualified names obligatory again. --PDM]