1: doctype public "-//IDN etl.sf.net//ETL//Grammar 0.2.1";
2:
3: grammar net.sf.etl.samples.Forumula {
4: namespace default f = "http://etl.sf.net/2008/samples/plans/formula";
5:
6: context Expressions {
7: op composite FloatNumber(f) {
8: @value = integer | float;
9: };
10:
11: op composite Identifier(f) {
12: @value = identifier;
13: };
14:
15:
16: op composite Unit(f) {
17: @name = token(KwH) | token(USD);
18: };
19:
20: op Money(fx,50,$) {
21: @value = right;
22: };
23:
24: op UnaryMinus(fy,100,-) {
25: @value = right;
26: };
27:
28: op Multiply(yfx,200,*) {
29: @left = left;
30: @right = right;
31: };
32:
33: op Divide(yfx,200,/) {
34: @left = left;
35: @right = right;
36: };
37:
38: op Plus(yfx,300,+) {
39: @left = left;
40: @right = right;
41: };
42:
43: op Minus(yfx,300,-) {
44: @left = left;
45: @right = right;
46: };
47:
48:
49: op Less(xfx,500, < ) {
50: @left = left;
51: @right = right;
52: };
53:
54: op Greater(xfx,500, > ) {
55: @left = left;
56: @right = right;
57: };
58:
59: op composite If(fy, 800) {
60: % if;
61: @ condition = expression;
62: % then;
63: @ thenPart = expression;
64: % else;
65: @ elsePart = right;
66: };
67:
68: op composite Account(fx, 1000) {
69: % account;
70: @ name = identifier;
71: % <-;
72: @ value = right;
73: };
74: };
75: };