[project @ 1999-06-01 16:15:42 by simonmar]
[ghc-hetmet.git] / ghc / compiler / parser / binding.ugn
index 25c7802..d5d66f9 100644 (file)
@@ -2,10 +2,10 @@
 #include "hspincl.h"
 %}
 %{{
+module U_binding where
+
 #include "HsVersions.h"
 
-module U_binding where
-IMP_Ubiq() --  debugging consistency check
 import UgenUtil
 
 import U_constr
@@ -15,67 +15,104 @@ import U_qid
 import U_ttype
 %}}
 type binding;
+       nullbind : < >;
+
+       /* And-bind; just concat two decl blobs together */
+       abind   : < gabindfst   : binding;
+                   gabindsnd   : binding; >;
+
+       /* Import decl */
+       import  : < gibindimod   : stringId;
+                   gibindqual   : long;
+                   gibindas     : maybe;
+                   gibindspec   : maybe;
+                   gibindsource : long;
+                   gibindline   : long; >;
+
+       /* Fixity decl */
+       fixd    : < gfixop      : qid;
+                   gfixinfx    : long;
+                   gfixprec    : long; 
+                   gfixline    : long; >;
+
+
+       /* Class declaration */
+       cbind   : < gcbindc     : list;
+                   gcbindid    : ttype;
+                   gcbindw     : binding;
+                   gcline      : long; >;
+
+       /* Instance declaration */
+       ibind   : < gibindi     : ttype;
+                   gibindw     : binding;
+                   giline      : long; >;
+
+       /* data type declaration */
        tbind   : < gtbindc     : list;         /* [context entries] */
                    gtbindid    : ttype;        /* applied tycon */
                    gtbindl     : list;         /* [constr] */
                    gtbindd     : maybe;        /* Maybe [deriving] */
                    gtline      : long; >;
+
+       /* newtype declaration */
        ntbind  : < gntbindc    : list;         /* [context entries] */
                    gntbindid   : ttype;        /* applied tycon */
                    gntbindcty  : list;         /* [constr]  (only 1 constrnew) */ 
                    gntbindd    : maybe;        /* Maybe [deriving] */
                    gntline     : long; >;
+
+       /* type synonym declaration */
        nbind   : < gnbindid    : ttype;
                    gnbindas    : ttype;
                    gnline      : long; >;
-       pbind   : < gpbindl     : list;
+
+       /* Pattern binding */
+       pbind   : < gpbindl     : VOID_STAR;    /* The pattern, of type tree; 
+                                                  we can't say 'tree' because
+                                                  that gives mutual recursion in the C */
+                   gpbindr     : VOID_STAR;    /* The RHS, of type grhsb; same nonsense */
                    gpline      : long; >;
-       fbind   : < gfbindl     : list;
+       /* Function binding */
+       fbind   : < gfbindm     : list;         /* List of matches */
+                                               /* The match encodes the LHS as well as RHS */
                    gfline      : long; >;
-       abind   : < gabindfst   : binding;
-                   gabindsnd   : binding; >;
-       ibind   : < gibindc     : list;
-                   gibindid    : qid;
-                   gibindi     : ttype;
-                   gibindw     : binding;
-                   giline      : long; >;
+
+       /* Default decl */
        dbind   : < gdbindts    : list;
                    gdline      : long; >;
-       cbind   : < gcbindc     : list;
-                   gcbindid    : ttype;
-                   gcbindw     : binding;
-                   gcline      : long; >;
+
+       /* Type signature */
        sbind   : < gsbindids   : list;
                    gsbindid    : ttype;
                    gsline      : long; >;
 
-       nullbind : < >;
-
-       import  : < gibindimod   : stringId;
-                   gibindqual   : long;
-                   gibindas     : maybe;
-                   gibindspec   : maybe;
-                   gibindsource : long;
-                   gibindline   : long; >;
+        /* FFI declarations */
+       fobind  : < gfobind_id   : qid;
+                   gfobind_ty   : ttype;
+                   gfobind_ext  : maybe;
+                   gfobind_flag : long;
+                   gfobind_cc   : long;
+                   gfobind_kind : long;
+                   gfobind_line : long; >;
+                   
 
        /* user-specified pragmas:XXXX */
 
        vspec_uprag : < gvspec_id   : qid;
-                       gvspec_tys  : list;
+                       gvspec_tys  : list;     /* Of type */
                        gvspec_line : long; >;
 
        vspec_ty_and_id : < gvspec_ty : ttype;
                        gvspec_tyid : maybe; /* nil or singleton */ >;
 
-       ispec_uprag : < gispec_clas : qid;
-                       gispec_ty   : ttype;
+       ispec_uprag : < gispec_ty   : ttype;
                        gispec_line : long; >;
 
        inline_uprag: < ginline_id   : qid;
                        ginline_line : long; >;
 
-       deforest_uprag: < gdeforest_id : qid;
-                       gdeforest_line : long; >;
+       noinline_uprag: < gnoinline_id   : qid;
+                         gnoinline_line : long; >;
 
        magicuf_uprag:< gmagicuf_id   : qid;
                        gmagicuf_str  : stringId;
@@ -85,4 +122,10 @@ type binding;
                        gdspec_tys  : list;
                        gdspec_line : long; >;
 
+       /* Transformation rule */
+       rule_prag       : < grule_name   : hstring;
+                           grule_forall : list;
+                           grule_lhs    : VOID_STAR;   /* Really tree, but mutual recursion problem in C */
+                           grule_rhs    : VOID_STAR;   /* Really tree, but mutual recursion problem in C */
+                           grule_line   : long;  >;
 end;