Changes in the YCP grammar

In order to make the YCP syntax clearer and to reduce ambiguities in the Yacc-grammar, some syntactical rules have been refined. This reduced the number of conflicts reported by the parser generator from 146 to 2 (!)

Double qoutes

The use of double qoutes (``) is somewhat restricted now but does not reduce functionality as used by now.

Double qoutes are only allowed for blocks (``{ ... }), expressions (``( ... )) and terms (``identifier( ... )).
There is no space allowed between the double qoute and the following symbol.

Map expressions

Map expressions are still defined by ($[ ... ]), but $[ is a single token now and must be written without space inbetween.

Expressions are no statements

There is a clear destinction now between expressions (having a value) and statements (having a semantical meaning). In the old syntax expressions could be used as statements. Since this make the syntax ambiguous and is useless anyway, statements like 1 + 1; are not allowed.

Declaration is no value

The old syntax allowed declarations (type definitions) as values. However this made the syntax highly ambiguous and accounted for most of the conflicts reported by the parser generator. In fact this feature of a functional language wasn't used, ycp usage is imperative.
If values like [ integer, float ] (list of declarations) are really needed, the syntax can be re-introduced into the grammar with some 'syntactical sugar' (a special keyword).


Klaus Kämpf
Last modified: Thu May 11 09:21:42 MEST 2000