File: rpnconstruct.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 (40 lines) | stat: -rw-r--r-- 958 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Here is how to compile and run the parser file:
        verb(
    # List files (recursively) in the (current) examples/rpn  directory.
    % ls -R 
    .:
    build*  main.cc  parser/  rpn.ih
    
    ./parser:
    grammar  lex.cc  Parser.ih
    
    # Create `rpn' using the `build' script:
    % ./build program
    
    # List files again, ./rpn is the constructed program
    % ls -R
    .:
    build*  main.cc  parser/  program*  rpn.ih
    
    ./parser:
    grammar  grammar.output  lex.cc  parse.cc  Parserbase.h  Parser.h  Parser.ih
        )

    Here is an example session using the calculator:
        verb(
    % program
    4 9 +
            13
    3 7 + 3 4 5 *+-
            -13
    3 7 + 3 4 5 * + - n              Note the unary minus, `n'
            13
    5 6 / 4 n +
            -3.16667
    3 4 ^                            Exponentiation
            81
    ^D                               End-of-file indicator
    %
        )