~ubuntu-branches/ubuntu/hardy/pxp/hardy

« back to all changes in this revision

Viewing changes to examples/eventparser/expr.mly

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2005-03-29 11:06:39 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050329110639-5p39hz1d4aq3r2ec
Tags: 1.1.95-6
* Rebuilt against ocaml 3.08.3
* No longer built with wlex support (since wlex is no longer supported
  upstream and corresponding package has been removed from the debian
  archive)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
%token Space Newline Stop
 
3
%token Add Sub Mult Div LParen RParen
 
4
%token<int> Number
 
5
 
 
6
%start topexpr
 
7
%type<int> topexpr
 
8
 
 
9
%left Add Sub
 
10
%left Mult Div
 
11
%nonassoc Number LParen RParen
 
12
 
 
13
%%
 
14
 
 
15
topexpr:
 
16
  expr Stop { $1 }
 
17
;
 
18
 
 
19
expr:
 
20
  expr Add expr        { $1 + $3 }
 
21
| expr Sub expr        { $1 - $3 }
 
22
| expr Mult expr       { $1 * $3 }
 
23
| expr Div expr        { $1 / $3 }
 
24
| LParen expr RParen   { $2 }
 
25
| Number               { $1 }
 
26
;
 
27