HANDBOOK / GENTLE PRIMER / Describing Syntax /

# Actions in Grammar Rules

Besides computations on parameter position (as in the above example), grammar rules can also contain normal statements such as predicate invocations to compute attribute values.

The second rule could have been written

       'rule' bits(-> R): bits(-> N) bit(-> B) ShiftAndAdd(N, B -> R)

where `ShiftAndAdd` is an action.