File: rpngram.yo

package info (click to toggle)
bisonc%2B%2B 6.09.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,984 kB
  • sloc: cpp: 9,375; ansic: 1,505; fortran: 1,134; makefile: 1,062; sh: 526; yacc: 84; lex: 60
file content (20 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.