~ubuntu-branches/ubuntu/hardy/dicelab/hardy

« back to all changes in this revision

Viewing changes to tree.tc

  • Committer: Bazaar Package Importer
  • Author(s): Robert Lemmen
  • Date: 2007-12-10 17:06:15 UTC
  • Revision ID: james.westby@ubuntu.com-20071210170615-q1av8grz0vjiv397
Tags: upstream-0.5
ImportĀ upstreamĀ versionĀ 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%option lang = "C"
 
2
%option track_lines
 
3
 
 
4
%decls %{
 
5
#include  "roll.h"
 
6
%}
 
7
 
 
8
%{
 
9
#include <stdio.h>
 
10
#include <math.h>
 
11
#include <string.h>
 
12
#include "tree.h"
 
13
#include "util.h"
 
14
 
 
15
int yyerror(char *s);
 
16
 
 
17
%}
 
18
 
 
19
%enum filter_type =
 
20
{
 
21
        drop,
 
22
    keep
 
23
}
 
24
 
 
25
%enum comparison_type =
 
26
{
 
27
        eq,
 
28
    ne,
 
29
        lt,
 
30
        gt,
 
31
        le,
 
32
        ge
 
33
}
 
34
 
 
35
%enum ordering_type =
 
36
{
 
37
        agnostic,
 
38
        caring
 
39
}
 
40
 
 
41
%node expression %abstract %typedef =
 
42
{
 
43
        %nocreate struct symtab *symtab = {NULL};
 
44
        %nocreate ordering_type ordering = {caring};
 
45
}
 
46
 
 
47
%node elist expression
 
48
 
 
49
%node binary expression %abstract  =
 
50
{
 
51
    expression *expr1;
 
52
    expression *expr2;
 
53
}
 
54
 
 
55
%node unary expression %abstract =
 
56
{
 
57
    expression *expr;
 
58
}
 
59
 
 
60
%node number expression = {
 
61
        int num;
 
62
}
 
63
 
 
64
%node negate unary
 
65
%node dice unary
 
66
%node sum unary
 
67
%node prod unary
 
68
%node count unary
 
69
%node perm unary
 
70
%node sort unary
 
71
%node rev unary
 
72
 
 
73
%node mathop binary %abstract
 
74
%node plus mathop
 
75
%node minus mathop
 
76
%node multi mathop
 
77
%node divi mathop
 
78
%node mod mathop
 
79
%node expo mathop
 
80
 
 
81
%node scat binary
 
82
%node rep binary
 
83
%node range binary
 
84
%node lcat binary
 
85
 
 
86
%node ifthenelse expression =
 
87
{
 
88
    expression *if_expr;
 
89
    expression *then_expr;
 
90
    expression *else_expr;
 
91
}
 
92
 
 
93
%node filter binary %abstract =
 
94
{
 
95
    filter_type type;
 
96
}
 
97
 
 
98
%node first filter
 
99
%node last filter
 
100
%node high filter
 
101
%node low filter
 
102
 
 
103
%node comparison filter = 
 
104
{
 
105
        comparison_type comp;
 
106
}
 
107
 
 
108
%node let binary = 
 
109
{
 
110
        char *varname;
 
111
}
 
112
 
 
113
%node foreach binary = 
 
114
{
 
115
        char *varname;
 
116
}
 
117
 
 
118
%node whiledo binary = 
 
119
{
 
120
        char *varname;
 
121
}
 
122
 
 
123
%node variable expression = 
 
124
{
 
125
        char * varname;
 
126
}
 
127
 
 
128
%include "printtree.tc"
 
129
%include "roll.tc"
 
130
%include "symtab.tc"
 
131
%include "ordering.tc"
 
132
%include "eval.tc"
 
133