The SIRA_PRISE language grammar

The grammar

In this section, the grammar of the SIRA_PRISE commands is presented in BNF form. For a detailed treatment of the individual commands, please see the language reference and tutorial. The following preliminary notes on interpreting the grammar apply :

  • Vertical braces | indicate that exactly one of the options given can substitute the defined token. The scope of the braces is just the words immediately surrounding them. E.g. the rule INQUIRE|SELECT <RelationalExpression> is to be interpreted as : either INQUIRE <RelationalExpression> or else SELECT <RelationalExpression>.
  • '+', '*', '+,' and '*,' are cardinality signs. indicating that the syntactic category they are suffixed to, can appear multiple times. '+' indicates a required minimum of at least 1 appearance of the syntactic category, '*' indicates a required minimum of zero appearances of the syntactic category, '+,' and '*,' indicate that the several items listed must be separated by a comma.
  • Square brackets [] indicate (i.e. they surround) an optional part of the grammatical construct.
  • All other tokens, (uppercased words, commas that are not part of the syntactical cardinality tokens '+,' and '*,', parentheses etc) are part of the SIRA_PRISE syntax and should be typed exactly as indicated.
  • Whitespace is not allowed within names and keywords, but can be used everywhere else between those words to enhance readability. If whitespace appears within a <LiteralValue>, then it is assumed to be part of the value, and is thus not "skipped" by the parser.
  • Parentheses are syntactical tokens of the "meta-language", and that causes the obvious problem wherever/whenever such a token is explicitly not to be interpreted as one of the language itself, e.g. in the specification of a String literal. For that purpose, the backslash character is defined as an 'escape' token, such that String literals holding parentheses can be specified as well. For the backslash token not to be interpreted as an escape token, it has to be preceded by an escape token, i.e. '\'. Thus the value selector STRING(\(\)\\) denotes the three-character string '()\' .
<SiraPriseCommand> := <Add>|<Delete>|<Update>|<Inquire>|<MultipleAssignment>+
<MultipleAssignment> := CMD(<Add>|<Delete>|<Update>)
<Inquire> := INQUIRE|SELECT <RelationalExpression>[,(<AttributeName>+,)]
<Add> := ASSERT|ADD|CREATE <RelvarName>,<RelationalExpression>
<Delete> := UNASSERT|DELETE|REMOVE <RelvarName>,<RelationalExpression>
<Update> := UPDATE|MODIFY <RelvarName>,<RelationalExpression>,(<UpdateExpression>+)
<UpdateExpression> := <AttributeName>(<Expression>)
<Expression> := <WithExpression>|<PlainExpression>
<WithExpression> := WITH(<WithDef>+(<Expression>))
<WithDef> := <IntroducedExpressionName>(<Expression>)
<PlainExpression> := <RelationalExpression>|<TuplicalExpression>|<ScalarExpression>
<TuplicalExpression> := <AttributeName>|<TupleValueSelector>
<RelationalExpression> := <RelvarName>|<AttributeName>|<NamedRelationValueSelector>|<UnNamedRelationValueSelector|<RelationalOperatorExpression>
<NamedRelationValueSelector> := <RelvarName>(<TupleValueSelector>*)
<UnNamedRelationValueSelector> := RELATION([HEADING(<HeadingAttribute>*)]BODY(<TupleValueSelector>*))
<HeadingAttribute> := <SHeadingAttribute>|<RHeadingAttribute>
<SHeadingAttribute> := <AttributeName>(<TypeName>)
<RHeadingAttribute> := <AttributeName>(RELATION(HEADING(<HeadingAttribute>*)))
<TupleValueSelector> := TUPLE(<AttributeValueSelector>*)
<AttributeValueSelector> := <AttributeName>(<Expression>)
<RelationalOperatorExpression> := <ROjoin> | <ROunion> | <ROintersect> | <ROminus> | <ROsemiminus> | <ROsemijoin> | <ROrename> | <ROproject> | <ROrestrict> | <ROtclose> | <ROdivideby> | <ROextend> | <ROgroup> | <ROungroup> | <ROaggregate> | <ROSummarizeBy> | <ROTransform> | <ROleftjoin> | <ROxminus> | <ROGTClose> | <ROPack> | <ROUnpack> | <ROJoinusing> | <ROUnionusing> | <ROIntersectusing> | <ROMinususing> | <ROSemijoinusing> | <ROSemiminususing> | <ROLeftjoinusing>
<ROjoin> := JOIN(<RelationalExpression>,<RelationalExpression>+,)
<ROunion> := UNION(<RelationalExpression>,<RelationalExpression>+,)
<ROintersect> := INTERSECT(<RelationalExpression>,<RelationalExpression>+,)
<ROxminus> := XMINUS(<RelationalExpression>,<RelationalExpression>+,)
<ROminus> := MINUS(<RelationalExpression>,<RelationalExpression>)
<ROsemijoin> := SEMIJOIN(<RelationalExpression>,<RelationalExpression>)
<ROleftjoin> := LEFTJOIN(<RelationalExpression>,<RelationalExpression>,(<AttributeValueSelector>*))
<ROsemiminus> := SEMIMINUS(<RelationalExpression>,<RelationalExpression>)
<ROrename> := RENAME(<RelationalExpression>,(<AttributeNamePair>*,))
<AttributeNamePair> := <AttributeName>,<AttributeName>
<ROproject> := PROJECT(<RelationalExpression>,(<AttributeName>*))
<ROrestrict> := RESTRICT(<RelationalExpression>,<ScalarExpression>)
<ROtclose> := TCLOSE(<RelationalExpression>,(<AttributeNamePair>+,))
<ROdivideby> := DIVIDEBYPER(<RelationalExpression>,<RelationalExpression>,<RelationalExpression>)
<ROextend> := EXTEND(<RelationalExpression>,(<ExtendDef>+))
<ExtendDef> := <AttributeName>(<Expression>)
<ROgroup> := GROUP(<RelationalExpression>,(<GroupDef>+))
<GroupDef> := <AttributeName>(<AttributeName>+,)
<ROungroup> := UNGROUP(<RelationalExpression>,(<AttributeName>+,))
<ROaggregate> := AGGREGATE(<RelationalExpression>,(<AggregationDef>+))
<AggregationDef> := <AttributeName>(<OperatorName>(<Expression>))
<ROSummarizeBy> := SUMMARIZEBY(<RelationalExpression>,(<AttributeName>*,),(<AggregationDef>+))
<ROTransform> := TRANSFORM(<RelationalExpression>,(<TransformDef>*,))
<TransformDef> := <AttributeName>[(<Expression>)]
<ROgtclose> := GTCLOSE(<RelationalExpression>,(<AttributeNamePair>+,),(<GTCloseDef>*))
<GTCloseDef> := <AttributeName>(<Expression>)
<ROPack> := PACK(<RelationalExpression>,(<AttributeName>+))
<ROUnpack> := UNPACK(<RelationalExpression>,(<AttributeName>+))
<ROJoinusing> := JOINUSING(<RelationalExpression>,<RelationalExpression>+, ,(<AttributeName>*,))
<ROUnionusing> := UNIONUSING(<RelationalExpression>,<RelationalExpression>+, ,(<AttributeName>*,))
<ROIntersectusing> := INTERSECTUSING(<RelationalExpression>,<RelationalExpression>+, ,(<AttributeName>*,))
<ROXminususing> := XMINUSUSING(<RelationalExpression>,<RelationalExpression>+, ,(<AttributeName>*,))
<ROMinususing> := MINUSUSING(<RelationalExpression>,<RelationalExpression>,(<AttributeName>*,))
<ROSemijoinusing> := SEMIJOINUSING(<RelationalExpression>,<RelationalExpression>,(<AttributeName>*,))
<ROSemiminususing> := SEMIMINUSUSING(<RelationalExpression>,<RelationalExpression>,(<AttributeName>*,))
<ROLeftjoinusing> := LEFTJOINUSING(<RelationalExpression>,<RelationalExpression>,(<AttributeValueSelector>*),(<AttributeName>*,))
<ScalarExpression> := <ScalarValueSelector>|<AttributeName>|<ScalarOperatorExpression>
<ScalarValueSelector> := <TypeName>(<LiteralValue>|<PossRepComponent>+)
<PossRepComponent> := <PossRepComponentName>(<LiteralValue>|<ScalarExpression>)
<ScalarOperatorExpression> := <OperatorName>(<Expression>*,)

The following constructs are not explicitly defined in this grammar :


The first six of these are names, and should obey the rules for valid SIRA_PRISE names :

  • The only valid tokens are the alphabetic characters a-z, the digits 0-9, the special characters @ (at sign or amphora), _ (underscore), . (decimal sign or full stop punctuation), and the space character. As for the alphabetic characters, case is irrelevant. SIRA_PRISE treats all names as case-insensitive.
  • They may not exceed the maximum length imposed by SIRA_PRISE on that particular type of name (which is 28 in all of the cases mentioned here).

The <LiteralValue> element is, obviously, subjected only to the rule that it must represent a valid value of the type of the value selector that it appears in.

Changes from 1.4

  • Base relvar attributes are now allowed to be nonscalar. The <update> and <updateExpression> production rules now allow any <Expression> to appear in the update list.
  • TUPLE was explicitly added to the type system. Expressions can thus be tuple-typed. The <Expression> production rule now includes <tuplicalExpression> to reflect that change.
  • The HEADING(...) part of an <UnNamedRelationValueSelector> was made optional. The information is derived from the BODY(...) if it is nonempty.
  • GTCLOSE, PACK and UNPACK were added to the set of available relational operators.
  • Explicitly defined USING<> versions for certain relational operators were added.
  • The WITH construct, which was already added to 1.4, has been added to this documentation.

Changes from 1.3

Support for COMPILE and CACHE has been removed.

Changes from 1.2

New relational operators LEFTJOIN and XMINUS were introduced.

Changes from 1.1

The <CommitCommand> has been dropped.  Commit and rollback have been integrated with the transaction control features available to the client (which is where they really belong). Please consult the appropriate message types in the SIRA_PRISE communication scenario documentation.