-
Notifications
You must be signed in to change notification settings - Fork 3
/
DMN.gf
91 lines (73 loc) · 2.66 KB
/
DMN.gf
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
abstract DMN =
WordnetNPs
--, Numeral
** {
flags startcat = DTable ;
cat
-- Categories. Partly correspond to the Haskell types,
-- but some things need to be handled differently, e.g. column headers.
DTable ;
DTRow ;
[DTRow]{2} ;
FEELexp ;
[FEELexp]{2} ;
FCell ;
[FCell]{2} ;
FCells ;
FBinOp ;
Comment ;
DMNVal ;
Bool ;
fun
Flt, Flte, Feq,
Fgte, Fgt : FBinOp ;
-- True, False : Bool ; -- All best languages require you to define your own Bool
VNOne : DMNVal ; -- Special constructor for 1: to prevent "you have 1 messages"
VS : String -> DMNVal ;
VN : Float -> DMNVal ;
-- VB : Bool -> DMNVal ;
NoComment : Comment ;
CommentString : String -> Comment ;
FAnything : FEELexp ;
FNullary : DMNVal -> FEELexp ;
FSection : FBinOp -> DMNVal -> FEELexp ;
FInRange : Float -> Float -> FEELexp ;
FInRangeInt : Int -> Int -> FEELexp ;
-- FFunction : FNumFunction -> FEELexp ;
-- BaseFEELexp, ConsFEELexp constructed automatically thanks to [FEELexp]{2}
Disj : [FEELexp] -> FEELexp ; -- Used inside one cell
-- Add header to an FEELexp to build a FCell
Attribute, -- Fallback: Header is FEELexp "Dish is Stew"
Event, -- {Event,Dissolution} ~ "upon Dissolution"
Location, -- {City,Paris} ~ "In Paris", "In any City"
Duration, -- {Weeks,[3..5]} ~ "Between 3 and 5 Weeks"
TimeClock, -- {Time,14:00} ~ "At 2 PM", "At any Time"
TimeSeason, -- {Month,May} ~ "In May", "In any Month"
Weight, -- {XWeight,3 kg} ~ "X weighs 3 kg"
Length, -- {XLength,3 m} ~ "X is 3 m long"
Height -- {XHeight,3 m} ~ "X is 3 m tall"
: CN -> FEELexp -> FCell ;
AmountMass, -- {Cups,X,5} ~ "With 5 Cups of X". NB. the header needs to contain the unit and the material.
AmountCount -- {Count, X, =<10} ~ "With 10 or fewer Xs"
: CN -> CN -> FEELexp -> FCell ;
IsTrue,
IsFalse
: CN -> FCell ; -- {Liquidation} ~ "is liquidation"
-- BaseFCell, ConsFCell constructed automatically thanks to [FCell]{2}
Many : [FCell] -> FCells ;
Single : FCell -> FCells ;
-- Booleans in many cells behave like one cell:
-- "when X, Y and Z" sounds more natural than
-- "when X, when Y and when Z"
BoolFCell : [FCell] -> FCell ;
-- Construct a row from input and output cells.
-- Concrete syntaxes may leave out comment, line number or both.
Row : Int -> -- row number
FCells -> -- inputs
FCells -> -- outputs
Comment -> -- comments
DTRow ;
-- Finally, the full table.
Table : [DTRow] -> DTable ;
Consequence : [DTRow] -> DTable ;
}