[project @ 1999-05-18 15:03:54 by simonpj]
[ghc-hetmet.git] / ghc / compiler / parser / binding.ugn
1 %{
2 #include "hspincl.h"
3 %}
4 %{{
5 module U_binding where
6
7 #include "HsVersions.h"
8
9 import UgenUtil
10
11 import U_constr
12 import U_list
13 import U_maybe
14 import U_qid
15 import U_ttype
16 %}}
17 type binding;
18         nullbind : < >;
19
20         /* And-bind; just concat two decl blobs together */
21         abind   : < gabindfst   : binding;
22                     gabindsnd   : binding; >;
23
24         /* Import decl */
25         import  : < gibindimod   : stringId;
26                     gibindqual   : long;
27                     gibindas     : maybe;
28                     gibindspec   : maybe;
29                     gibindsource : long;
30                     gibindline   : long; >;
31
32         /* Fixity decl */
33         fixd    : < gfixop      : qid;
34                     gfixinfx    : long;
35                     gfixprec    : long; 
36                     gfixline    : long; >;
37
38
39         /* Class declaration */
40         cbind   : < gcbindc     : list;
41                     gcbindid    : ttype;
42                     gcbindw     : binding;
43                     gcline      : long; >;
44
45         /* Instance declaration */
46         ibind   : < gibindi     : ttype;
47                     gibindw     : binding;
48                     giline      : long; >;
49
50         /* data type declaration */
51         tbind   : < gtbindc     : list;         /* [context entries] */
52                     gtbindid    : ttype;        /* applied tycon */
53                     gtbindl     : list;         /* [constr] */
54                     gtbindd     : maybe;        /* Maybe [deriving] */
55                     gtline      : long; >;
56
57         /* newtype declaration */
58         ntbind  : < gntbindc    : list;         /* [context entries] */
59                     gntbindid   : ttype;        /* applied tycon */
60                     gntbindcty  : list;         /* [constr]  (only 1 constrnew) */ 
61                     gntbindd    : maybe;        /* Maybe [deriving] */
62                     gntline     : long; >;
63
64         /* type synonym declaration */
65         nbind   : < gnbindid    : ttype;
66                     gnbindas    : ttype;
67                     gnline      : long; >;
68
69         /* Pattern binding */
70         pbind   : < gpbindl     : VOID_STAR;    /* The pattern, of type tree; 
71                                                    we can't say 'tree' because
72                                                    that gives mutual recursion in the C */
73                     gpbindr     : VOID_STAR;    /* The RHS, of type grhsb; same nonsense */
74                     gpline      : long; >;
75         /* Function binding */
76         fbind   : < gfbindm     : list;         /* List of matches */
77                                                 /* The match encodes the LHS as well as RHS */
78                     gfline      : long; >;
79
80         /* Default decl */
81         dbind   : < gdbindts    : list;
82                     gdline      : long; >;
83
84         /* Type signature */
85         sbind   : < gsbindids   : list;
86                     gsbindid    : ttype;
87                     gsline      : long; >;
88
89         /* FFI declarations */
90         fobind  : < gfobind_id   : qid;
91                     gfobind_ty   : ttype;
92                     gfobind_ext  : maybe;
93                     gfobind_flag : long;
94                     gfobind_cc   : long;
95                     gfobind_kind : long;
96                     gfobind_line : long; >;
97                     
98
99         /* user-specified pragmas:XXXX */
100
101         vspec_uprag : < gvspec_id   : qid;
102                         gvspec_tys  : list;     /* Of type */
103                         gvspec_line : long; >;
104
105         vspec_ty_and_id : < gvspec_ty : ttype;
106                         gvspec_tyid : maybe; /* nil or singleton */ >;
107
108         ispec_uprag : < gispec_ty   : ttype;
109                         gispec_line : long; >;
110
111         inline_uprag: < ginline_id   : qid;
112                         ginline_line : long; >;
113
114         noinline_uprag: < gnoinline_id   : qid;
115                           gnoinline_line : long; >;
116
117         magicuf_uprag:< gmagicuf_id   : qid;
118                         gmagicuf_str  : stringId;
119                         gmagicuf_line : long; >;
120
121         dspec_uprag : < gdspec_id   : qid;
122                         gdspec_tys  : list;
123                         gdspec_line : long; >;
124
125         /* Transformation rule */
126         rule_prag       : < grule_name   : hstring;
127                             grule_forall : list;
128                             grule_lhs    : VOID_STAR;   /* Really tree, but mutual recursion problem in C */
129                             grule_rhs    : VOID_STAR;   /* Really tree, but mutual recursion problem in C */
130                             grule_line   : long;  >;
131 end;