Relevance language Grammar

The grammar for the relevance language can be expressed in the Backus Naur Format as follows:

<primary> := ( <expression> ) | string | numeral | it

<index> := phrase <primary> | phrase | <primary>

<property> := phrase <primary> <whose primary> <of property> |

primary <whose primary> <of property>

<cast> := <cast> as phrase | < property >

<phrase> := item | number | <expression>

<unary> := exists <unary> | notExists <unary> | not <unary> | - <unary> | <cast>

<productOperator> := * | / | mod | &

<product> := <product> <productOperator> <unary> | <unary>

<sum> := <sum> + <product> | <sum> - <product> | <product>

<relationExpr> := <sum> relation <sum> | <sum>

<relation> := relationOperator | relationPhrase

<relationOperator> := = | != | < | > | <= | >=

<relationPhrase> := is | is equal to | equals | is not | is not equal to | does not equal |

is greater than | is not greater than | is less than | is not less than |

is less than or equal to | is not less than or equal to |

is greater than or equal to | is not greater than or equal to | contains |

does not contain | is contained by | is not contained by | starts with |

does not start with | ends with | does not end with

<andExpression> := <andExpression> and <relationExpr> | <relationExpr>

<orExpression> := <orExpression> or <andExpression> | <andExpression>

<tuple> := <orExpression> , <tuple> | <orExpression>

<collection> := <collection> ; <tuple> | <tuple>

<expression> := if <expression> then <expression> else <expression> | <collection>