Rule Probability Referencing Expression

PostfixExpr :=

| 'probof' '[' Expr ']'

| 'probof' '(' Identifier_t ')'

| 'specified'

| 'specifiedremain'

| 'specifiedremainof' '(' Expr ')'

| 'remain'

| 'remainof' '(' Expr ')'

| 'prev'

| 'prevremain'

| 'prevremainof' '(' Expr ')'

| 'post'

| 'postremain'

| 'postremainof' '(' Expr ')'

These are bridging productions from the nonterminal PostfixExpr in C, which is to match expressions with precedence equal or higher than that of array entry references or function calls. Here, these are different ways of referring to the rule probabilities or some expressions related to them. All these may be used in setting configure parameters (usually rule probabilities) in generator configuration construction (more detailed discussion of the semantics of these in generator configurations can be see at smart rule probability configuration section), and in addition, the first two may also be used in the pre-selector section.

The first two productions are direct reference to a single rule probability entry, by rule index (zero-indexing) for the nonterminal and by rule name, respectively. They can be used as l-values or r-values (while others can only be used as r-values).

'specified' means the sum of probabilities from the same nonterminal type that are set with expressions not containing 'specified' or any other relevant variants (approximately meaning those explicit specified). 'prev' means the sum of probabilities from the same nonterminal that are set before this rule. 'post' means the sum of probabilities from the same nonterminal that are set after this rule.

Adding the 'remain' suffix means 1.0 minus what it was, indicating the remaining probability; while the 'remainof' suffix subtract from an arbitrary expression instead of 1.0, which might be used when the probability (or rather weights) are not normalized. 'remain' and 'remainof' as keywords themselves are aliases to 'specifiedremain' and 'specifiedremainof'.

  • Expr is a nonterminal in C for any expression.

  • Identifier_t is a terminal in C that matches any valid identifier, which is the rule name here.