Here are the grammar rules for the reverse polish notation calculator. verbinsert(//RULES rpn/parser/grammar) The rules of the tt(rpn) `language' defined here are the expression (using the name tt(exp)), the line of input (tt(line)), and the complete input transcript (tt(input)). Each of these nonterminal symbols has several alternate rules, joined by the `tt(|)' separator, separating the various production rules. The various rules are explained next. The semantics of the language are determined by the actions taken once nonterminals have been recognized. The actions consist of bf(C++) code that appears inside braces. See section ref(ACTIONS). Actions are specified using bf(C++), but b() provides the means for passing semantic values between rules. Refer to section ref(ACTIONS) below for an extensive coverage of the various possibilities. As a short introduction, the pseudo-variable tt($$) can be used in rules to represent the semantic value for the nonterminal that the production rule is defining. Assigning a value to tt($$) is the main task of many actions. The semantic values of the elements of production rules are referred to as tt($1) (the first element of a production rule), tt($2) (the second element), and so on.