]> git.saurik.com Git - bison.git/blobdiff - tests/existing.at
Credit Satya for the graphviz change.
[bison.git] / tests / existing.at
index 2297e00490f781052800dda6d0fb79b90effa27f..9db625a96368429e18ea1e43b1853d8fb36f4081 100644 (file)
@@ -1,5 +1,7 @@
 # Exercising Bison on actual grammars.                   -*- Autotest -*-
-# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -13,8 +15,8 @@
 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 AT_BANNER([[Existing Grammars.]])
 ## ----------------- ##
@@ -111,7 +113,6 @@ function_body
        | l_brace r_brace opt_semi opt_nls
        ;
 
-
 pattern
        : exp
        | exp ',' exp
@@ -356,7 +357,6 @@ AT_CHECK([[bison --verbose --defines input.y]])
 
 AT_CLEANUP
 
-
 ## ----------------- ##
 ## GNU Cim Grammar.  ##
 ## ----------------- ##
@@ -369,57 +369,44 @@ AT_SETUP([GNU Cim Grammar])
 # It reported 80 SR && 99 RR conflicts instead of 78/10!!!
 
 AT_DATA([[input.y]],
-[[%union {
-       long token;
-       long ival;
-        long arrdim;
-       double rval;
-       char *ident;
-       char *tval;
-       char stat_decl;
-       }
+[[%union {}
 
 %token
-        HACTIVATE HAFTER /*HAND*/ HARRAY HAT
-        HBEFORE HBEGIN HBOOLEAN
-        HCHARACTER HCLASS /*HCOMMENT*/ HCONC
-        HDELAY HDO
-        HELSE HEND HEQ /*HEQV*/ HEXTERNAL
-        HFOR
-        HGE HGO HGOTO HGT
-        HHIDDEN
-        HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
-        HLABEL HLE HLONG HLT
-        HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
-        /*HOR*/ HOTHERWISE
-        HPRIOR HPROCEDURE HPROTECTED
-        HQUA
-        HREACTIVATE HREAL HREF
-        HSHORT HSTEP HSWITCH
-        HTEXT HTHEN HTHIS HTO
-        HUNTIL
-        HVALUE HVAR HVIRTUAL
-        HWHEN HWHILE
-
-        HASSIGNVALUE HASSIGNREF
-        /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
-        HBEGPAR HENDPAR
-        HEQR HNER
-        HADD HSUB HMUL HDIV HINTDIV HEXP
-       HDOTDOTDOT
-
-%token <ident> HIDENTIFIER
-%token <ival> HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
-%token <rval> HREALKONST
-%token <tval> HTEXTKONST
-
-%type <tval> EXT_IDENT
-%type <stat_decl> DECLSTATEMENT MODULSTATEMENT MBEE_DECLSTMS MBEE_DECLSTMSU
-%type <stat_decl> MODULS
-%type <ident> EXPRESSION_SIMP MBEE_ARG_R_PT
-%type <arrdim> BAUND_PAIR_LIST
-
-%right <token> HASSIGN
+       HACTIVATE HAFTER /*HAND*/ HARRAY HAT
+       HBEFORE HBEGIN HBOOLEAN
+       HCHARACTER HCLASS /*HCOMMENT*/ HCONC
+       HDELAY HDO
+       HELSE HEND HEQ /*HEQV*/ HEXTERNAL
+       HFOR
+       HGE HGO HGOTO HGT
+       HHIDDEN
+       HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
+       HLABEL HLE HLONG HLT
+       HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
+       /*HOR*/ HOTHERWISE
+       HPRIOR HPROCEDURE HPROTECTED
+       HQUA
+       HREACTIVATE HREAL HREF
+       HSHORT HSTEP HSWITCH
+       HTEXT HTHEN HTHIS HTO
+       HUNTIL
+       HVALUE HVAR HVIRTUAL
+       HWHEN HWHILE
+
+       HASSIGNVALUE HASSIGNREF
+       /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
+       HBEGPAR HENDPAR
+       HEQR HNER
+       HADD HSUB HMUL HDIV HINTDIV HEXP
+       HDOTDOTDOT
+
+%token HIDENTIFIER
+%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
+%token HREALKONST
+%token HTEXTKONST
+
+
+%right HASSIGN
 %left   HORELSE
 %left   HANDTHEN
 %left   HEQV
@@ -429,13 +416,13 @@ AT_DATA([[input.y]],
 
 %left   HNOT
 
-%left <token> HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR
+%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR
 
 %left  HCONC
 
-%left <token> HTERMOPERATOR
-%left <token> UNEAR
-%left <token> HFACTOROPERATOR
+%left HTERMOPERATOR
+%left UNEAR
+%left HFACTOROPERATOR
 %left         HPRIMARYOPERATOR
 
 %left   HQUA
@@ -445,55 +432,40 @@ AT_DATA([[input.y]],
 %start  MAIN_MODULE
 %%
 /* GRAMATIKK FOR PROGRAM MODULES */
-MAIN_MODULE     :       {        categ=CLOCAL; mout(MBLOCK);
-                                  beginBlock(KBLOKK);separat_comp=FALSE;}
-                       MODULS  { endBlock(NULL,CCNO);   mout(MENDBLOCK);}
-               |       error HSTATEMENTSEPARATOR MBEE_DECLSTMS
+MAIN_MODULE     :       {}
+                       MODULS
+               |       error HSTATEMENTSEPARATOR MBEE_DECLSTMS
                ;
 EXT_DECLARATION        :       HEXTERNAL
                        MBEE_TYPE
                        HPROCEDURE
-                               { MBEENEWBLOCK();
-                                 kind=KPROC;}
+                               {}
                        EXT_LIST
                |
                        HEXTERNAL
                        HIDENTIFIER
                        HPROCEDURE
-                               { MBEENEWBLOCK();
-                                 type=TNOTY;
-                                 kind=KPROC;
-                                 if($2==Ckind)categ=CCPROC;else
-                                 yerror (1);
-                                  ysensitive=sensitive;
-                                  sensitive=ON;}
-                       HIDENTIFIER { $<ident>$=$5;
-                                  sensitive=ysensitive;}
+                               {}
+                       HIDENTIFIER {}
                        EXTERNAL_KIND_ITEM
-                               { categ=CLOCAL;}
                |       HEXTERNAL
                        HCLASS
-                               { MBEENEWBLOCK();
-                                 kind=KCLASS;}
+                               {}
                        EXT_LIST
 
                ;
 EXTERNAL_KIND_ITEM:    EXT_IDENT
                        HOBJRELOPERATOR
-                               { if($2!=HIS)yerror (2);}
-                       MBEE_TYPE HPROCEDURE
+                               {}
+                       MBEE_TYPE HPROCEDURE
                        HIDENTIFIER
-                               {         regDecl($6, type, KPROC, CCPROC);
-                                          beginBlock(kind);}
-                        HEADING EMPTY_BLOCK
-                               { categ=CLOCAL;
-                                 endBlock($1==NULL?$<ident>0:tag($1),CCCPROC);}
+                               {}
+                       HEADING EMPTY_BLOCK
+                               {}
 /*             |
                        EXT_IDENT
-                               { if($1!=NULL)yerror (3);
-                                 regDecl($0, type, kind, categ);}
+                               {}
                        MBEE_REST_EXT_LIST
-                               { endBlock(NULL,CCNO);}
                ;
 MBEE_REST_EXT_LIST:    /* EMPTY
                |       HPAREXPSEPARATOR EXT_KIND_LIST
@@ -503,8 +475,7 @@ EXT_KIND_LIST       :       EXT_KIND_ITEM
                ;
 EXT_KIND_ITEM  :       HIDENTIFIER
                        EXT_IDENT
-                               { if($2!=NULL)yerror (3);
-                                 regDecl($1, type, kind, categ);}*/
+                               {}*/
                ;
 EMPTY_BLOCK    :       /*EMPT*/
                |       HBEGIN HEND
@@ -514,676 +485,470 @@ EXT_LIST        :       EXT_ITEM
                ;
 EXT_ITEM       :       HIDENTIFIER
                        EXT_IDENT
-                               { lesinn_external_spec($1,$2, kind);}
                ;
-EXT_IDENT      :       /* EMPTY */ { $$=NULL;}
-               |       HVALRELOPERATOR { if($1!=HEQ)yerror (9);
-                                          external=TRUE;}
-                       HTEXTKONST { $$=$3;external=FALSE;}
+EXT_IDENT      :       /* EMPTY */
+               |       HVALRELOPERATOR {}
+                       HTEXTKONST
                ;
 /* GRAMATIKK FOR TYPER */
-NO_TYPE         :       /*EMPT*/        { type=TNOTY;}
-                ;
+NO_TYPE         :       /*EMPT*/
+               ;
 MBEE_TYPE       :       NO_TYPE
-                |       TYPE
-                ;
+               |       TYPE
+               ;
 TYPE            :       HREF HBEGPAR
-                        HIDENTIFIER
-                                { prefquantident=$3;
-                                          type=TREF;}
-                        HENDPAR
-                |       HTEXT           { type=TTEXT;}
-                |       HBOOLEAN        { type=TBOOL;}
-                |       HCHARACTER      { type=TCHAR;}
-                |       HSHORT HINTEGER { type=TSHORT;}
-                |       HINTEGER        { type=TINTG;}
-                |       HREAL           { type=TREAL;}
-                |       HLONG HREAL     { type=TLONG;}
-                ;
+                       HIDENTIFIER
+                               {}
+                       HENDPAR
+               |       HTEXT
+               |       HBOOLEAN
+               |       HCHARACTER
+               |       HSHORT HINTEGER
+               |       HINTEGER
+               |       HREAL
+               |       HLONG HREAL
+               ;
 
 /* GRAMATIKK FOR DEL AV SETNINGER */
 MBEE_ELSE_PART  :       /*EMPT*/
 /*             |       HELSE
                        HIF
-                        EXPRESSION
-                        HTHEN   {                mout(MELSE);
-                                                 mout(MIF);
-                                  OBSBLOCK();}
-                        BLOCK   { MBEEENDBLOCK();}
-                        MBEE_ELSE_PART          { mout(MENDIF);}*/
-                |       HELSE   { OBSBLOCK();     mout(MELSE);}
-                        BLOCK   { MBEEENDBLOCK();}
-                ;
-FOR_LIST        :       FOR_LIST_ELEMENT        { mout(MENDSEP);
-                                                  mout(MLISTSEP);}
-                |       FOR_LIST_ELEMENT
-                        HPAREXPSEPARATOR
-                        FOR_LIST                { mout(MLISTSEP);}
-                ;
+                       EXPRESSION
+                       HTHEN   {}
+                       BLOCK   {}
+                       MBEE_ELSE_PART          {}*/
+               |       HELSE   {}
+                       BLOCK
+               ;
+FOR_LIST        :       FOR_LIST_ELEMENT
+               |       FOR_LIST_ELEMENT
+                       HPAREXPSEPARATOR
+                       FOR_LIST
+               ;
 FOR_LIST_ELEMENT:       EXPRESSION
-                        MBEE_F_L_EL_R_PT
-                ;
+                       MBEE_F_L_EL_R_PT
+               ;
 MBEE_F_L_EL_R_PT:       /*EMPT*/
-                |       HWHILE
-                        EXPRESSION              { mout(MFORWHILE);}
-                |       HSTEP
-                        EXPRESSION
-                        HUNTIL
-                        EXPRESSION              { mout(MUNTIL);
-                                                  mout(MSTEP);}
-                ;
+               |       HWHILE
+                       EXPRESSION
+               |       HSTEP
+                       EXPRESSION
+                       HUNTIL
+                       EXPRESSION
+               ;
 GOTO            :       HGO
-                        HTO
-                |       HGOTO
-                ;
+                       HTO
+               |       HGOTO
+               ;
 CONN_STATE_R_PT :       WHEN_CLAUSE_LIST
-                |       HDO   {   beginBlock(KCON);   mout(MDO);
-                              OBSBLOCK(); }
-                        BLOCK {   endBlock(NULL,CCNO);
-                                  MBEEENDBLOCK();  mout(MENDDO);}
-                ;
+               |       HDO   {}
+                       BLOCK
+               ;
 WHEN_CLAUSE_LIST:       HWHEN
-                        HIDENTIFIER
-                        HDO    {   beginBlock(KCON);  mout(MIDENTIFIER);
-                                   OBSBLOCK();     moutId($2);
-                                                  mout(MWHEN);}
-                        BLOCK  {   endBlock(NULL,CCNO);
-                              MBEEENDBLOCK(); mout(MENDWHEN);}
-                |       WHEN_CLAUSE_LIST
-                        HWHEN
-                        HIDENTIFIER
-                        HDO    { beginBlock(KCON);        mout(MIDENTIFIER);
-                                 OBSBLOCK();       moutId($3);
-                                                  mout(MWHEN);}
-                        BLOCK  { endBlock(NULL,CCNO);
-                              MBEEENDBLOCK();    mout(MENDWHEN);}
-                ;
+                       HIDENTIFIER
+                       HDO    {}
+                       BLOCK
+               |       WHEN_CLAUSE_LIST
+                       HWHEN
+                       HIDENTIFIER
+                       HDO    {}
+                       BLOCK
+               ;
 MBEE_OTWI_CLAUS :       /*EMPT*/
-                |       HOTHERWISE {OBSBLOCK();    mout(MOTHERWISE);}
-
-                        BLOCK      {MBEEENDBLOCK();mout(MENDOTHERWISE);}
-                ;
-ACTIVATOR      :       HACTIVATE               { mout(MBOOLEANKONST);
-                                                 moutIval(FALSE);}
-               |       HREACTIVATE             { mout(MBOOLEANKONST);
-                                                 moutIval(TRUE);}
-               ;
-SCHEDULE       :       /*EMPT*/                { mout(MCHARACTERKONST);
-                                                 moutIval(DIRECT);
-                                                 mout(MINTEGERKONST);
-                                                 moutIval(0);
-                                                 mout(MNONE);
-                                                 mout(MBOOLEANKONST);
-                                                 moutIval(FALSE);}
-               |       ATDELAY EXPRESSION      { mout(MNONE);}
+               |       HOTHERWISE {}
+
+                       BLOCK
+               ;
+ACTIVATOR      :       HACTIVATE
+               |       HREACTIVATE
+               ;
+SCHEDULE       :       /*EMPT*/
+               |       ATDELAY EXPRESSION      {}
                        PRIOR
-               |       BEFOREAFTER             { mout(MINTEGERKONST);
-                                                 moutIval(0);}
-                       EXPRESSION              { mout(MBOOLEANKONST);
-                                                 moutIval(FALSE);}
-               ;
-ATDELAY                :       HAT                     { mout(MCHARACTERKONST);
-                                                 moutIval(AT);}
-               |       HDELAY                  { mout(MCHARACTERKONST);
-                                                 moutIval(DELAYS);}
-               ;
-BEFOREAFTER    :       HBEFORE                 { mout(MCHARACTERKONST);
-                                                 moutIval(BEFORE);}
-               |       HAFTER                  { mout(MCHARACTERKONST);
-                                                 moutIval(AFTER);}
-               ;
-PRIOR          :       /*EMPT*/                { mout(MBOOLEANKONST);
-                                                 moutIval(FALSE);}
-               |       HPRIOR                  { mout(MBOOLEANKONST);
-                                                 moutIval(TRUE);}
+               |       BEFOREAFTER             {}
+                       EXPRESSION
+               ;
+ATDELAY                :       HAT
+               |       HDELAY
+               ;
+BEFOREAFTER    :       HBEFORE
+               |       HAFTER
+               ;
+PRIOR          :       /*EMPT*/
+               |       HPRIOR
                ;
 /* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */
 MODULSTATEMENT  :       HWHILE
-                        EXPRESSION
-                        HDO     { STOPOBSBLOCK(); mout(MWHILE);
-                                  OBSBLOCK();}
-                        BLOCK   { MBEEENDBLOCK(); mout(MENDWHILE);
-                                                         $$=STATEMENT;}
-               |       HIF
-                        EXPRESSION
-                        HTHEN   { STOPOBSBLOCK(); mout(MIF);
-                                  OBSBLOCK();}
-                        BLOCK   { MBEEENDBLOCK();}
-                        MBEE_ELSE_PART          { mout(MENDIF);
-                                                         $$=STATEMENT;}
+                       EXPRESSION
+                       HDO     {}
+                       BLOCK
+               |       HIF
+                       EXPRESSION
+                       HTHEN   {}
+                       BLOCK   {}
+                       MBEE_ELSE_PART
                |       HFOR
-                        HIDENTIFIER
-                        HASSIGN { STOPOBSBLOCK(); mout(MIDENTIFIER);
-                                                  moutId($2);}
-                        FOR_LIST
-                        HDO     { beginBlock(KFOR);
-                        if($3==HASSIGNVALUE)      mout(MFOR);
-                                        else      mout(MFORR);
-                                  OBSBLOCK();     mout(MFORDO);}
-                        BLOCK   { MBEEENDBLOCK();
-                                  endBlock(NULL,CCNO); mout(MENDFOR);
-                                                         $$=STATEMENT;}
+                       HIDENTIFIER
+                       HASSIGN {}
+                       FOR_LIST
+                       HDO     {}
+                       BLOCK
                |       GOTO
-                        EXPRESSION              { mout(MGOTO);
-                                  STOPOBSBLOCK();        $$=STATEMENT;}
+                       EXPRESSION
                |       HINSPECT
-                        EXPRESSION              { mout(MINSPECT);
-                                  STOPOBSBLOCK();
-                                  beginBlock(KINSP);}
-                        CONN_STATE_R_PT
-                                { endBlock(NULL,CCNO);}
-                        MBEE_OTWI_CLAUS         { mout(MENDINSPECT);
-                                                         $$=STATEMENT;}
-               |       HINNER  { STOPOBSBLOCK(); mout(MINNER);
-                                  regInner();            $$=STATEMENT;}
-                |       HIDENTIFIER
-                        HLABELSEPARATOR
-                                { STOPOBSBLOCK();
-                                  regDecl($1, TLABEL, KSIMPLE, categ);    mout(MLABEL);
-                                                  moutId($1);
-                                                  mout(MENDLABEL);}
-                        DECLSTATEMENT   { if($4<=DECLARATION)
-                                            { yerror (27);
-                                              $$=DECLARATION;}
-                                          else $$=$4;}
-                |       EXPRESSION_SIMP
-                        HBEGIN
-                                { $<ident>$=$1; }
+                       EXPRESSION              {}
+                       CONN_STATE_R_PT
+                               {}
+                       MBEE_OTWI_CLAUS
+               |       HINNER
+               |       HIDENTIFIER
+                       HLABELSEPARATOR
+                               {}
+                       DECLSTATEMENT
+               |       EXPRESSION_SIMP
+                       HBEGIN
+                               {}
                        IMPORT_SPEC_MODULE
-                               { mout(MPRBLOCK);
-                                 prefquantident=$1;
-                                  beginBlock(KPRBLK);}
-                        MBEE_DECLSTMS
-                        HEND    { endBlock(NULL,CCNO); mout(MENDPRBLOCK);
-                                                          $$=STATEMENT;}
+                               {}
+                       MBEE_DECLSTMS
+                       HEND
                |       EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR
-                        MBEE_DECLSTMS HEND              { $$=STATEMENT;
-                                endBlock(NULL,CCNO); mout(MENDPRBLOCK);}
+                       MBEE_DECLSTMS HEND
                |       EXPRESSION_SIMP HBEGIN error HEND
-                                                       { $$=STATEMENT;
-                                endBlock(NULL,CCNO); mout(MENDPRBLOCK);}
-
-                |       EXPRESSION_SIMP
-                                { STOPOBSBLOCK();         $$=STATEMENT;
-                                                  mout(MENDASSIGN);}
+               |       EXPRESSION_SIMP
                |       ACTIVATOR EXPRESSION SCHEDULE
-                                               {         $$=STATEMENT;
-                                                 mout(MENDSEP);
-                                                 mout(MARGUMENTSEP);
-                                                 mout(MARGUMENTSEP);
-                                                 mout(MARGUMENTSEP);
-                                                 mout(MARGUMENTSEP);
-                                                 mout(MARGUMENTSEP);
-                                                 mout(MARGUMENTSEP);
-                                                 mout(MARGUMENT);
-                                                 moutId(activateid);
-                                                 mout(MENDASSIGN);}
-                |       HBEGIN
-                                { STOPOBSBLOCK();
-                                  OBSBLOCK();}
-                        MBEE_DECLSTMS
-                        HEND    { MBEEENDBLOCK();         $$=STATEMENT;}
+               |       HBEGIN
+                               {}
+                       MBEE_DECLSTMS
+                       HEND
                |       MBEE_TYPE HPROCEDURE
-                        HIDENTIFIER
-                                { MBEENEWBLOCK(); mout(MPROCEDURE);
-                                          regDecl($3, type, KPROC, categ);
-                                          beginBlock(KPROC);}
-                        HEADING BLOCK   { endBlock(NULL,CCNO); $$=DECLARATION;
-                                                  mout(MENDPROCEDURE);}
+                       HIDENTIFIER
+                               {}
+                       HEADING BLOCK
                |       HIDENTIFIER
                        HCLASS
-                        NO_TYPE
-                               { $<ident>$=$1; }
+                       NO_TYPE
+                               {}
                        IMPORT_SPEC_MODULE
-                        HIDENTIFIER
-                               { prefquantident=$1;
-                                 mout(MCLASS);
-                                          regDecl($6, TNOTY, KCLASS, categ);
-                                          beginBlock(KCLASS);}
-                        HEADING
-                        BLOCK           { endBlock(NULL,CCNO); $$=DECLARATION;
-                                                  mout(MENDCLASS);}
-                |       HCLASS
-                        NO_TYPE
-                        HIDENTIFIER
-                                { prefquantident=0;
-                                  MBEENEWBLOCK(); mout(MCLASS);
-                                          regDecl($3, TNOTY, KCLASS, categ);
-                                          beginBlock(KCLASS);}
-                        HEADING
-                        BLOCK           { endBlock(NULL,CCNO); $$=DECLARATION;
-                                                  mout(MENDCLASS);}
-                |       EXT_DECLARATION                        { $$=EXTDECLARATION;}
-               |       /*EMPT*/{ STOPOBSBLOCK();         $$=EMPTYSTATEMENT;}
-                ;
-IMPORT_SPEC_MODULE:            { MBEENEWBLOCK();
-                                  kind=KCLASS;
-                                 if($<ident>0==simsetident &&
-                                    findDecl(simsetident,cblock,FALSE)==NULL)
-                                   lesinn_external_spec(simsetident,
-                                       SIMSETATRFILE, kind);
-                                 if($<ident>0==simulationident && findDecl(
-                                   simulationident,cblock,FALSE)==NULL)
-                                   lesinn_external_spec(simulationident,
-                                       SIMULATIONATRFILE, kind);
-                                 if(($<ident>0==fileident && findDecl(
-                                     fileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==outfileident && findDecl(
-                                     outfileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==infileident && findDecl(
-                                     infileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==directfileident && findDecl(
-                                     directfileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==printfileident && findDecl(
-                                     printfileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==bytefileident && findDecl(
-                                     bytefileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==inbytefileident && findDecl(
-                                     inbytefileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==outbytefileident && findDecl(
-                                     outbytefileident,cblock,FALSE)==NULL) ||
-                                    ($<ident>0==directbytefileident && findDecl(
-                                     directbytefileident,cblock,FALSE)==NULL))
-                                   lesinn_external_spec(fileident,
-                                       FILEATRFILE, kind);}
+                       HIDENTIFIER
+                               {}
+                       HEADING
+                       BLOCK
+               |       HCLASS
+                       NO_TYPE
+                       HIDENTIFIER
+                               {}
+                       HEADING
+                       BLOCK
+               |       EXT_DECLARATION
+               |       /*EMPT*/
+               ;
+IMPORT_SPEC_MODULE:
                ;
 DECLSTATEMENT  :       MODULSTATEMENT
                |       TYPE
-                        HIDENTIFIER
+                       HIDENTIFIER
                        MBEE_CONSTANT
-                        HPAREXPSEPARATOR
-                                { MBEENEWBLOCK();
-                                          kind=KSIMPLE;
-                                          regDecl($2, type, KSIMPLE, categ);
-                                         categ=CLOCAL;}
-                        IDENTIFIER_LISTC                { $$=DECLARATION;}
-                |       TYPE
-                        HIDENTIFIER
+                       HPAREXPSEPARATOR
+                               {}
+                       IDENTIFIER_LISTC
+               |       TYPE
+                       HIDENTIFIER
                        MBEE_CONSTANT
-                                { MBEENEWBLOCK();
-                                          regDecl($2, type, KSIMPLE, categ);
-                                         categ=CLOCAL;   $$=DECLARATION;}
-                |       MBEE_TYPE
-                        HARRAY  { MBEENEWBLOCK();
-                                          kind=KARRAY;}
-                        ARR_SEGMENT_LIST                { $$=DECLARATION;}
-                |       HSWITCH
-                        HIDENTIFIER
-                        HASSIGN { MBEENEWBLOCK(); mout(MIDENTIFIER);
-                                                  moutId($2);
-                                          regDecl($2, TLABEL, KARRAY, categ);}
-                        SWITCH_LIST                     { $$=DECLARATION;
-                                                   mout(MSWITCH);
-                                                   mout(MENDSWITCH);}
-                ;
-BLOCK           :       DECLSTATEMENT   { if($1<=DECLARATION)yerror (29);}
-                |       HBEGIN MBEE_DECLSTMS HEND
+               |       MBEE_TYPE
+                       HARRAY  {}
+                       ARR_SEGMENT_LIST
+               |       HSWITCH
+                       HIDENTIFIER
+                       HASSIGN {}
+                       SWITCH_LIST
+               ;
+BLOCK           :       DECLSTATEMENT
+               |       HBEGIN MBEE_DECLSTMS HEND
                |       HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND
                |       HBEGIN error HEND
                ;
-MBEE_DECLSTMS   :       MBEE_DECLSTMSU  { if($1<=DECLARATION)yerror (28);
-                                         $$=$1;}
-                ;
-MBEE_DECLSTMSU  :       DECLSTATEMENT   { $$=$1;}
-                |       MBEE_DECLSTMSU
-                        HSTATEMENTSEPARATOR
-                        DECLSTATEMENT   { if($1>=STATEMENT && $3<=DECLARATION)
-                                            yerror (26);
-                                          $$=$3;}
-                ;
-MODULS         :       MODULSTATEMENT  { if($1==DECLARATION)
-                                         {separat_comp=TRUE;gettimestamp();}
-                                          $$=$1;}
-               |       MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
-                                       { if($1>=STATEMENT && $3<=DECLARATION)
-                                            yerror (26);else
-                                                 if($1>=STATEMENT
-                                            && $3!=EMPTYSTATEMENT)yerror (25);
-                                          if(separat_comp && $3==STATEMENT)
-                                             yerror (25);
-                                          if($3==DECLARATION && !separat_comp)
-                                         {separat_comp=TRUE;gettimestamp();}
-                                         $$=$3;}
+MBEE_DECLSTMS   :       MBEE_DECLSTMSU
+               ;
+MBEE_DECLSTMSU  :       DECLSTATEMENT
+               |       MBEE_DECLSTMSU
+                       HSTATEMENTSEPARATOR
+                       DECLSTATEMENT
+               ;
+MODULS         :       MODULSTATEMENT
+               |       MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
                ;
 /* GRAMATIKK FOR DEL AV DEKLARASJONER */
 ARR_SEGMENT_LIST:       ARR_SEGMENT
-                |       ARR_SEGMENT_LIST
-                        HPAREXPSEPARATOR
-                        ARR_SEGMENT
-                ;
+               |       ARR_SEGMENT_LIST
+                       HPAREXPSEPARATOR
+                       ARR_SEGMENT
+               ;
 ARR_SEGMENT    :       ARRAY_SEGMENT
-                        HBEGPAR
-                        BAUND_PAIR_LIST HENDPAR { mout(MARRAY);
-                                                  mout(MENDARRAY);
-                                                  setArrayDim($3);}
-                ;
-ARRAY_SEGMENT   :       ARRAY_SEGMENT_EL        { mout(MENDSEP);
-                                                  mout(MARRAYSEP);}
-
-                |       ARRAY_SEGMENT_EL
-                        HPAREXPSEPARATOR
-                        ARRAY_SEGMENT           { mout(MARRAYSEP);}
-                ;
-ARRAY_SEGMENT_EL:       HIDENTIFIER             { mout(MIDENTIFIER);
-                                                  moutId($1);
-                                                  regDecl($1, type, kind, categ);
-                                  if(lastArray==NULL)
-                                     lastArray=cblock->lastparloc;}
-                ;
-BAUND_PAIR_LIST :       BAUND_PAIR              { mout(MENDSEP);
-                                                  mout(MBOUNDSEP);
-                                                  $$=1;}
-                |       BAUND_PAIR
-                        HPAREXPSEPARATOR
-                        BAUND_PAIR_LIST         { mout(MBOUNDSEP);
-                                                  $$=$3+1;}
-                ;
+                       HBEGPAR
+                       BAUND_PAIR_LIST HENDPAR
+               ;
+ARRAY_SEGMENT   :       ARRAY_SEGMENT_EL        {}
+
+               |       ARRAY_SEGMENT_EL
+                       HPAREXPSEPARATOR
+                       ARRAY_SEGMENT
+               ;
+ARRAY_SEGMENT_EL:       HIDENTIFIER
+               ;
+BAUND_PAIR_LIST :       BAUND_PAIR
+               |       BAUND_PAIR
+                       HPAREXPSEPARATOR
+                       BAUND_PAIR_LIST
+               ;
 BAUND_PAIR      :       EXPRESSION
-                        HLABELSEPARATOR
-                        EXPRESSION              { mout(MBOUNDPARSEP);}
-                ;
-SWITCH_LIST     :       EXPRESSION              { mout(MENDSEP);
-                                                  mout(MSWITCHSEP);}
-                |       EXPRESSION
-                        HPAREXPSEPARATOR
-                        SWITCH_LIST             { mout(MSWITCHSEP);}
-                ;
-HEADING         :       MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR { kind=KNOKD;}
-                        MBEE_MODE_PART  { categ=CSPEC;}
-                        MBEE_SPEC_PART  { kind=KNOKD;}
-                        MBEE_PROT_PART  { categ=CVIRT;}
-                        MBEE_VIRT_PART
-                                        { categ=CLOCAL;}
-                ;
+                       HLABELSEPARATOR
+                       EXPRESSION
+               ;
+SWITCH_LIST     :       EXPRESSION
+               |       EXPRESSION
+                       HPAREXPSEPARATOR
+                       SWITCH_LIST
+               ;
+HEADING         :       MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {}
+                       MBEE_MODE_PART  {}
+                       MBEE_SPEC_PART  {}
+                       MBEE_PROT_PART  {}
+                       MBEE_VIRT_PART
+               ;
 MBEE_FMAL_PAR_P :       /*EMPT*/
-                |       FMAL_PAR_PART
-                ;
+               |       FMAL_PAR_PART
+               ;
 FMAL_PAR_PART   :       HBEGPAR NO_TYPE
-                        MBEE_LISTV HENDPAR
-                ;
+                       MBEE_LISTV HENDPAR
+               ;
 MBEE_LISTV      :       /*EMPT*/
-                |       LISTV
-                ;
-LISTV           :       HIDENTIFIER     { regDecl($1, type, KNOKD, CDEFLT);}
-                |      FPP_CATEG HDOTDOTDOT      { regDecl(varargsid, TVARARGS, KNOKD, categ);}
-                |       HIDENTIFIER     { regDecl($1, type, KNOKD, CDEFLT);}
-                        HPAREXPSEPARATOR LISTV {}
-                |       FPP_SPEC
-                |       FPP_SPEC
-                        HPAREXPSEPARATOR LISTV
-                ;
+               |       LISTV
+               ;
+LISTV           :       HIDENTIFIER
+               |       FPP_CATEG HDOTDOTDOT
+               |       HIDENTIFIER     {}
+                       HPAREXPSEPARATOR LISTV
+               |       FPP_SPEC
+               |       FPP_SPEC
+                       HPAREXPSEPARATOR LISTV
+               ;
 FPP_HEADING     :       HBEGPAR NO_TYPE
-                        FPP_MBEE_LISTV HENDPAR
-                ;
+                       FPP_MBEE_LISTV HENDPAR
+               ;
 FPP_MBEE_LISTV  :       /*EMPT*/
-                |       FPP_LISTV
-                ;
-FPP_LISTV       :      FPP_CATEG HDOTDOTDOT      { regDecl(varargsid, TVARARGS, KNOKD, categ);}
-                |       FPP_SPEC
-                |       FPP_SPEC
-                        HPAREXPSEPARATOR LISTV
-                ;
+               |       FPP_LISTV
+               ;
+FPP_LISTV       :      FPP_CATEG HDOTDOTDOT
+               |       FPP_SPEC
+               |       FPP_SPEC
+                       HPAREXPSEPARATOR LISTV
+               ;
 FPP_SPEC        :       FPP_CATEG SPECIFIER HIDENTIFIER
-                                       { regDecl($3, type, kind, categ);}
                |       FPP_CATEG FPP_PROC_DECL_IN_SPEC
                ;
 FPP_CATEG       :       HNAME HLABELSEPARATOR
-                                       { categ=CNAME;}
-                |       HVALUE HLABELSEPARATOR
-                                       { categ=CVALUE;}
-                |       HVAR HLABELSEPARATOR
-                                       { categ=CVAR;}
-                |       /*EMPT*/       { categ=CDEFLT;}
-                ;
+               |       HVALUE HLABELSEPARATOR
+               |       HVAR HLABELSEPARATOR
+               |       /*EMPT*/
+               ;
 FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
-                        HIDENTIFIER
-                                       { $<ival>$=categ;
-                                          regDecl($3, type, KPROC, categ);
-                                          beginBlock(KPROC);}
-                        FPP_HEADING
-                                       { categ=$<ival>4; /* M} settes tilbake*/}
-                               { endBlock(NULL,CCNO);}
-               ;
-IDENTIFIER_LISTV:       HIDENTIFIER     { regDecl($1, type, kind, categ);}
-                |      HDOTDOTDOT {      regDecl(varargsid, TVARARGS, kind, categ);}
-                |       HIDENTIFIER     { regDecl($1, type, kind, categ);}
-                        HPAREXPSEPARATOR IDENTIFIER_LISTV {}
-                ;
+                       HIDENTIFIER
+                                       {}
+                       FPP_HEADING {} { /* Yes, two "final" actions. */ }
+               ;
+IDENTIFIER_LISTV:       HIDENTIFIER
+               |       HDOTDOTDOT
+               |       HIDENTIFIER     {}
+                       HPAREXPSEPARATOR IDENTIFIER_LISTV
+               ;
 MBEE_MODE_PART  :       /*EMPT*/
-                |       MODE_PART
-                ;
+               |       MODE_PART
+               ;
 MODE_PART       :       NAME_PART
-                |       VALUE_PART
-                |       VAR_PART
-                |       NAME_PART VALUE_PART
-                |       VALUE_PART NAME_PART
-                |       NAME_PART VAR_PART
-                |       VAR_PART NAME_PART
-                |       VALUE_PART VAR_PART
-                |       VAR_PART VALUE_PART
-                |       VAR_PART NAME_PART VALUE_PART
-                |       NAME_PART VAR_PART VALUE_PART
-                |       NAME_PART VALUE_PART VAR_PART
-                |       VAR_PART VALUE_PART NAME_PART
-                |       VALUE_PART VAR_PART NAME_PART
-                |       VALUE_PART NAME_PART VAR_PART
-                ;
-NAME_PART       :       HNAME           { categ=CNAME;}
-                        IDENTIFIER_LISTV
-                        HSTATEMENTSEPARATOR
-                ;
-VAR_PART        :       HVAR            { categ=CVAR;}
-                        IDENTIFIER_LISTV
-                        HSTATEMENTSEPARATOR
-                ;
-VALUE_PART      :       HVALUE          { categ=CVALUE;}
-                        IDENTIFIER_LISTV HSTATEMENTSEPARATOR
-                ;
+               |       VALUE_PART
+               |       VAR_PART
+               |       NAME_PART VALUE_PART
+               |       VALUE_PART NAME_PART
+               |       NAME_PART VAR_PART
+               |       VAR_PART NAME_PART
+               |       VALUE_PART VAR_PART
+               |       VAR_PART VALUE_PART
+               |       VAR_PART NAME_PART VALUE_PART
+               |       NAME_PART VAR_PART VALUE_PART
+               |       NAME_PART VALUE_PART VAR_PART
+               |       VAR_PART VALUE_PART NAME_PART
+               |       VALUE_PART VAR_PART NAME_PART
+               |       VALUE_PART NAME_PART VAR_PART
+               ;
+NAME_PART       :       HNAME           {}
+                       IDENTIFIER_LISTV
+                       HSTATEMENTSEPARATOR
+               ;
+VAR_PART        :       HVAR            {}
+                       IDENTIFIER_LISTV
+                       HSTATEMENTSEPARATOR
+               ;
+VALUE_PART      :       HVALUE          {}
+                       IDENTIFIER_LISTV HSTATEMENTSEPARATOR
+               ;
 MBEE_SPEC_PART  :       /*EMPT*/
-                |       SPEC_PART
-                ;
+               |       SPEC_PART
+               ;
 SPEC_PART       :       ONE_SPEC
-                |       SPEC_PART ONE_SPEC
-                ;
+               |       SPEC_PART ONE_SPEC
+               ;
 ONE_SPEC       :       SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR
                |       NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR
-                         { if($4!=HIS) yerror (8);}
+                         {}
                        PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
-                |       FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
-                |       MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
-                                       { yerror (45);}
-                |       MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
-                        IDENTIFIER_LIST HSTATEMENTSEPARATOR
-                                       { yerror (45);}
-               ;
-SPECIFIER       :       TYPE            { kind=KSIMPLE;}
-                |       MBEE_TYPE
-                        HARRAY          { kind=KARRAY;}
-                |       HLABEL          { type=TLABEL;
-                                          kind=KSIMPLE;}
-                |       HSWITCH         { type=TLABEL;
-                                          kind=KARRAY;}
-                ;
+               |       FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
+               |       MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
+               |       MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
+                       IDENTIFIER_LIST HSTATEMENTSEPARATOR
+               ;
+SPECIFIER       :       TYPE
+               |       MBEE_TYPE
+                       HARRAY
+               |       HLABEL
+               |       HSWITCH
+               ;
 PROC_DECL_IN_SPEC:     MBEE_TYPE HPROCEDURE
-                        HIDENTIFIER
-                                       { $<ival>$=categ;
-                                          regDecl($3, type, KPROC, categ);
-                                          beginBlock(KPROC);}
-                        HEADING
-                                       { categ=$<ival>4; /* M} settes tilbake*/}
+                       HIDENTIFIER
+                                       {}
+                       HEADING
+                                       {}
                        MBEE_BEGIN_END
-                               { endBlock(NULL,CCNO);}
                ;
 MBEE_BEGIN_END :       /* EMPTY */
                |       HBEGIN HEND
                ;
 MBEE_PROT_PART  :       /*EMPT*/
-                |       PROTECTION_PART
-                ;
+               |       PROTECTION_PART
+               ;
 PROTECTION_PART :       PROT_SPECIFIER IDENTIFIER_LIST
-                        HSTATEMENTSEPARATOR
-                |       PROTECTION_PART  PROT_SPECIFIER
-                        IDENTIFIER_LIST HSTATEMENTSEPARATOR
-                ;
-PROT_SPECIFIER  :       HHIDDEN         { categ=CHIDEN;}
-                |       HPROTECTED      { categ=CPROT;}
-                |       HHIDDEN
-                        HPROTECTED      { categ=CHIPRO;}
-                |       HPROTECTED
-                        HHIDDEN         { categ=CHIPRO;}
-                ;
+                       HSTATEMENTSEPARATOR
+               |       PROTECTION_PART  PROT_SPECIFIER
+                       IDENTIFIER_LIST HSTATEMENTSEPARATOR
+               ;
+PROT_SPECIFIER  :       HHIDDEN
+               |       HPROTECTED
+               |       HHIDDEN
+                       HPROTECTED
+               |       HPROTECTED
+                       HHIDDEN
+               ;
 MBEE_VIRT_PART  :       /*EMPT*/
-                |       VIRTUAL_PART
-                ;
+               |       VIRTUAL_PART
+               ;
 VIRTUAL_PART    :       HVIRTUAL
-                        HLABELSEPARATOR
-                        MBEE_SPEC_PART
-                ;
-IDENTIFIER_LIST :       HIDENTIFIER     { regDecl($1, type, kind, categ);}
-                |       IDENTIFIER_LIST HPAREXPSEPARATOR
-                        HIDENTIFIER     { regDecl($3, type, kind, categ);}
-                ;
+                       HLABELSEPARATOR
+                       MBEE_SPEC_PART
+               ;
+IDENTIFIER_LIST :       HIDENTIFIER
+               |       IDENTIFIER_LIST HPAREXPSEPARATOR
+                       HIDENTIFIER
+               ;
 IDENTIFIER_LISTC:       HIDENTIFIER
-                       MBEE_CONSTANT   { regDecl($1, type, kind, categ);
-                                         categ=CLOCAL;}
-                |       IDENTIFIER_LISTC HPAREXPSEPARATOR
-                        HIDENTIFIER
-                       MBEE_CONSTANT   { regDecl($3, type, kind, categ);
-                                         categ=CLOCAL;}
-                ;
+                       MBEE_CONSTANT
+               |       IDENTIFIER_LISTC HPAREXPSEPARATOR
+                       HIDENTIFIER
+                       MBEE_CONSTANT
+               ;
 MBEE_CONSTANT  :       /* EMPTY */
                |       HVALRELOPERATOR
-                               { MBEENEWBLOCK();
-                           if($1!=HEQ) yerror (8);
-                                         if(type==TREF)yerror (7);
-                                         categ=CCONSTU;
-                                                 mout(MIDENTIFIER);
-                                                 moutId($<token>0);}
-                       EXPRESSION              { mout(MASSIGN);
-                                                 mout(MCONST);}
+                               {}
+                       EXPRESSION
                ;
 
 /* GRAMATIKK FOR UTTRYKK */
-EXPRESSION      :       EXPRESSION_SIMP {}
-                |       HIF
-                        EXPRESSION
-                        HTHEN
-                        EXPRESSION
-                        HELSE
-                        EXPRESSION              { mout(MELSEE);
-                                                  mout(MIFE);}
-                ;
+EXPRESSION      :       EXPRESSION_SIMP
+               |       HIF
+                       EXPRESSION
+                       HTHEN
+                       EXPRESSION
+                       HELSE
+                       EXPRESSION
+               ;
 EXPRESSION_SIMP :      EXPRESSION_SIMP
                        HASSIGN
-                       EXPRESSION { if($2==HASSIGNREF)mout(MASSIGNR);
-                                          else    mout(MASSIGN);$$=NULL;}
+                       EXPRESSION
                |
 
                        EXPRESSION_SIMP
-                        HCONC
-                        EXPRESSION_SIMP         { mout(MCONC);$$=NULL;}
-                |       EXPRESSION_SIMP HOR
-                        HELSE
-                        EXPRESSION_SIMP
-                        %prec HORELSE           { mout(MORELSEE);$$=NULL;}
-                |       EXPRESSION_SIMP HAND
-                        HTHEN
-                        EXPRESSION_SIMP
-                        %prec HANDTHEN          { mout(MANDTHENE);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HEQV EXPRESSION_SIMP    { mout(MEQV);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HIMP EXPRESSION_SIMP    { mout(MIMP);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HOR EXPRESSION_SIMP     { mout(MOR);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HAND EXPRESSION_SIMP    { mout(MAND);$$=NULL;}
-                |       HNOT EXPRESSION_SIMP    { mout(MNOT);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HVALRELOPERATOR
-                        EXPRESSION_SIMP
-                                { switch($2)
-                                    {   case HEQ: mout(MEQ);break;
-                                        case HNE: mout(MNE);break;
-                                        case HLT: mout(MLT);break;
-                                        case HLE: mout(MLE);break;
-                                        case HGT: mout(MGT);break;
-                                        case HGE: mout(MGE);break;
-                                    }$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HREFRELOPERATOR
-                        EXPRESSION_SIMP
-                                { if($2==HNER)    mout(MNER);
-                                        else      mout(MEQR);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HOBJRELOPERATOR
-                        EXPRESSION_SIMP
-                                { if($2==HIS)     mout(MIS);
-                                        else      mout(MINS);$$=NULL;}
-                |       HTERMOPERATOR
-                        EXPRESSION_SIMP %prec UNEAR
-                                { if($1==HADD)    mout(MUADD);
-                                        else      mout(MUSUB);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HTERMOPERATOR
-                        EXPRESSION_SIMP
-                                { if($2==HADD)    mout(MADD);
-                                        else      mout(MSUB);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HFACTOROPERATOR
-                        EXPRESSION_SIMP
-                                { if($2==HMUL)    mout(MMUL); else
-                                  if($2==HDIV)    mout(MDIV);
-                                        else      mout(MINTDIV);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HPRIMARYOPERATOR
-                        EXPRESSION_SIMP         { mout(MPRIMARY);$$=NULL;}
-                |       HBEGPAR
-                        EXPRESSION HENDPAR      { mout(MNOOP);$$=NULL;}
-                |       HTEXTKONST              { mout(MTEXTKONST);
-                                                  moutTval($1);$$=NULL;}
-                |       HCHARACTERKONST         { mout(MCHARACTERKONST);
-                                                  moutIval($1);$$=NULL;}
-                |       HREALKONST              { mout(MREALKONST);
-                                                  moutRval($1);$$=NULL;}
-                |       HINTEGERKONST           { mout(MINTEGERKONST);
-                                                  moutIval($1);$$=NULL;}
-                |       HBOOLEANKONST           { mout(MBOOLEANKONST);
-                                                  moutIval($1);$$=NULL;}
-                |       HNONE                   { mout(MNONE);$$=NULL;}
-                |       HIDENTIFIER
-                                { $<ident>$=$1;}
-                        MBEE_ARG_R_PT {}
-                |       HTHIS HIDENTIFIER       { mout(MTHIS);
-                                                  moutId($2);$$=NULL;}
-                |       HNEW
-                        HIDENTIFIER
-                        ARG_R_PT                { mout(MNEWARG);
-                                                  moutId($2);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HDOT
-                        EXPRESSION_SIMP         { mout(MDOT);$$=NULL;}
-                |       EXPRESSION_SIMP
-                        HQUA HIDENTIFIER        { mout(MQUA);
-                                                  moutId($3);$$=NULL;}
-                ;
-ARG_R_PT        :       /*EMPTY*/               { mout(MENDSEP);}
-                |       HBEGPAR
-                        ARGUMENT_LIST HENDPAR
-                ;
-MBEE_ARG_R_PT   :       /*EMPTY*/               { mout(MIDENTIFIER);
-                                                  moutId($<ident>0);
-                                                 $$=$<ident>0;}
-                |       HBEGPAR
-                        ARGUMENT_LIST HENDPAR   { mout(MARGUMENT);
-                                                  moutId($<ident>0);}
-                ;
-ARGUMENT_LIST   :       EXPRESSION              { mout(MENDSEP);
-                                                  mout(MARGUMENTSEP);}
-                |       EXPRESSION
-                        HPAREXPSEPARATOR
-                        ARGUMENT_LIST           { mout(MARGUMENTSEP);}
-                ;
+                       HCONC
+                       EXPRESSION_SIMP
+               |       EXPRESSION_SIMP HOR
+                       HELSE
+                       EXPRESSION_SIMP
+                       %prec HORELSE
+               |       EXPRESSION_SIMP HAND
+                       HTHEN
+                       EXPRESSION_SIMP
+                       %prec HANDTHEN
+               |       EXPRESSION_SIMP
+                       HEQV EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HIMP EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HOR EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HAND EXPRESSION_SIMP
+               |       HNOT EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HVALRELOPERATOR
+                       EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HREFRELOPERATOR
+                       EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HOBJRELOPERATOR
+                       EXPRESSION_SIMP
+               |       HTERMOPERATOR
+                       EXPRESSION_SIMP %prec UNEAR
+               |       EXPRESSION_SIMP
+                       HTERMOPERATOR
+                       EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HFACTOROPERATOR
+                       EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HPRIMARYOPERATOR
+                       EXPRESSION_SIMP
+               |       HBEGPAR
+                       EXPRESSION HENDPAR
+               |       HTEXTKONST
+               |       HCHARACTERKONST
+               |       HREALKONST
+               |       HINTEGERKONST
+               |       HBOOLEANKONST
+               |       HNONE
+               |       HIDENTIFIER
+                               {}
+                       MBEE_ARG_R_PT
+               |       HTHIS HIDENTIFIER
+               |       HNEW
+                       HIDENTIFIER
+                       ARG_R_PT
+               |       EXPRESSION_SIMP
+                       HDOT
+                       EXPRESSION_SIMP
+               |       EXPRESSION_SIMP
+                       HQUA HIDENTIFIER
+               ;
+ARG_R_PT        :       /*EMPTY*/
+               |       HBEGPAR
+                       ARGUMENT_LIST HENDPAR
+               ;
+MBEE_ARG_R_PT   :       /*EMPTY*/
+               |       HBEGPAR
+                       ARGUMENT_LIST HENDPAR
+               ;
+ARGUMENT_LIST   :       EXPRESSION
+               |       EXPRESSION
+                       HPAREXPSEPARATOR
+                       ARGUMENT_LIST
+               ;
 %%
 ]])
 
@@ -1207,3 +972,554 @@ State 427 conflicts: 9 shift/reduce, 2 reduce/reduce
 ]])
 
 AT_CLEANUP
+
+## ----------------- ##
+## GNU pic Grammar.  ##
+## ----------------- ##
+
+AT_SETUP([GNU pic Grammar])
+
+# GNU pic, part of groff.
+
+# Bison once reported shift/reduce conflicts that it shouldn't have.
+
+AT_DATA([[input.y]],
+[[%union {}
+
+%token LABEL
+%token VARIABLE
+%token NUMBER
+%token TEXT
+%token COMMAND_LINE
+%token DELIMITED
+%token ORDINAL
+%token TH
+%token LEFT_ARROW_HEAD
+%token RIGHT_ARROW_HEAD
+%token DOUBLE_ARROW_HEAD
+%token LAST
+%token UP
+%token DOWN
+%token LEFT
+%token RIGHT
+%token BOX
+%token CIRCLE
+%token ELLIPSE
+%token ARC
+%token LINE
+%token ARROW
+%token MOVE
+%token SPLINE
+%token HEIGHT
+%token RADIUS
+%token WIDTH
+%token DIAMETER
+%token FROM
+%token TO
+%token AT
+%token WITH
+%token BY
+%token THEN
+%token SOLID
+%token DOTTED
+%token DASHED
+%token CHOP
+%token SAME
+%token INVISIBLE
+%token LJUST
+%token RJUST
+%token ABOVE
+%token BELOW
+%token OF
+%token THE
+%token WAY
+%token BETWEEN
+%token AND
+%token HERE
+%token DOT_N
+%token DOT_E
+%token DOT_W
+%token DOT_S
+%token DOT_NE
+%token DOT_SE
+%token DOT_NW
+%token DOT_SW
+%token DOT_C
+%token DOT_START
+%token DOT_END
+%token DOT_X
+%token DOT_Y
+%token DOT_HT
+%token DOT_WID
+%token DOT_RAD
+%token SIN
+%token COS
+%token ATAN2
+%token LOG
+%token EXP
+%token SQRT
+%token K_MAX
+%token K_MIN
+%token INT
+%token RAND
+%token SRAND
+%token COPY
+%token THRU
+%token TOP
+%token BOTTOM
+%token UPPER
+%token LOWER
+%token SH
+%token PRINT
+%token CW
+%token CCW
+%token FOR
+%token DO
+%token IF
+%token ELSE
+%token ANDAND
+%token OROR
+%token NOTEQUAL
+%token EQUALEQUAL
+%token LESSEQUAL
+%token GREATEREQUAL
+%token LEFT_CORNER
+%token RIGHT_CORNER
+%token NORTH
+%token SOUTH
+%token EAST
+%token WEST
+%token CENTER
+%token END
+%token START
+%token RESET
+%token UNTIL
+%token PLOT
+%token THICKNESS
+%token FILL
+%token COLORED
+%token OUTLINED
+%token SHADED
+%token ALIGNED
+%token SPRINTF
+%token COMMAND
+
+%left '.'
+
+/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */
+%left PLOT
+%left TEXT SPRINTF
+
+/* give text adjustments higher precedence than TEXT, so that
+box "foo" above ljust == box ("foo" above ljust)
+*/
+
+%left LJUST RJUST ABOVE BELOW
+
+%left LEFT RIGHT
+/* Give attributes that take an optional expression a higher
+precedence than left and right, so that eg `line chop left'
+parses properly. */
+%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED
+%left LABEL
+
+%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST
+%left ORDINAL HERE '`'
+
+%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */
+
+/* these need to be lower than '-' */
+%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS
+
+/* these must have higher precedence than CHOP so that `label %prec CHOP'
+works */
+%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C
+%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER
+%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END
+
+%left ','
+%left OROR
+%left ANDAND
+%left EQUALEQUAL NOTEQUAL
+%left '<' '>' LESSEQUAL GREATEREQUAL
+
+%left BETWEEN OF
+%left AND
+
+%left '+' '-'
+%left '*' '/' '%'
+%right '!'
+%right '^'
+
+%%
+
+top:
+       optional_separator
+       | element_list
+       ;
+
+element_list:
+       optional_separator middle_element_list optional_separator
+       ;
+
+middle_element_list:
+       element
+       | middle_element_list separator element
+       ;
+
+optional_separator:
+       /* empty */
+       | separator
+       ;
+
+separator:
+       ';'
+       | separator ';'
+       ;
+
+placeless_element:
+       VARIABLE '=' any_expr
+       | VARIABLE ':' '=' any_expr
+       | UP
+       | DOWN
+       | LEFT
+       | RIGHT
+       | COMMAND_LINE
+       | COMMAND print_args
+       | PRINT print_args
+       | SH
+               {}
+         DELIMITED
+       | COPY TEXT
+       | COPY TEXT THRU
+               {}
+         DELIMITED
+               {}
+         until
+       | COPY THRU
+               {}
+         DELIMITED
+               {}
+         until
+       | FOR VARIABLE '=' expr TO expr optional_by DO
+               {}
+         DELIMITED
+       | simple_if
+       | simple_if ELSE
+               {}
+         DELIMITED
+       | reset_variables
+       | RESET
+       ;
+
+reset_variables:
+       RESET VARIABLE
+       | reset_variables VARIABLE
+       | reset_variables ',' VARIABLE
+       ;
+
+print_args:
+       print_arg
+       | print_args print_arg
+       ;
+
+print_arg:
+       expr                                                    %prec ','
+       | text
+       | position                                              %prec ','
+       ;
+
+simple_if:
+       IF any_expr THEN
+               {}
+       DELIMITED
+       ;
+
+until:
+       /* empty */
+       | UNTIL TEXT
+       ;
+
+any_expr:
+       expr
+       | text_expr
+       ;
+
+text_expr:
+       text EQUALEQUAL text
+       | text NOTEQUAL text
+       | text_expr ANDAND text_expr
+       | text_expr ANDAND expr
+       | expr ANDAND text_expr
+       | text_expr OROR text_expr
+       | text_expr OROR expr
+       | expr OROR text_expr
+       | '!' text_expr
+       ;
+
+optional_by:
+       /* empty */
+       | BY expr
+       | BY '*' expr
+       ;
+
+element:
+       object_spec
+       | LABEL ':' optional_separator element
+       | LABEL ':' optional_separator position_not_place
+       | LABEL ':' optional_separator place
+       | '{}'
+               {}
+         optional_element
+       | placeless_element
+       ;
+
+optional_element:
+       /* empty */
+       | element
+       ;
+
+object_spec:
+       BOX
+       | CIRCLE
+       | ELLIPSE
+       | ARC
+       | LINE
+       | ARROW
+       | MOVE
+       | SPLINE
+       | text                                                  %prec TEXT
+       | PLOT expr
+       | PLOT expr text
+       | '['
+               {}
+         element_list ']'
+       | object_spec HEIGHT expr
+       | object_spec RADIUS expr
+       | object_spec WIDTH expr
+       | object_spec DIAMETER expr
+       | object_spec expr                                      %prec HEIGHT
+       | object_spec UP
+       | object_spec UP expr
+       | object_spec DOWN
+       | object_spec DOWN expr
+       | object_spec RIGHT
+       | object_spec RIGHT expr
+       | object_spec LEFT
+       | object_spec LEFT expr
+       | object_spec FROM position
+       | object_spec TO position
+       | object_spec AT position
+       | object_spec WITH path
+       | object_spec WITH position                             %prec ','
+       | object_spec BY expr_pair
+       | object_spec THEN
+       | object_spec SOLID
+       | object_spec DOTTED
+       | object_spec DOTTED expr
+       | object_spec DASHED
+       | object_spec DASHED expr
+       | object_spec FILL
+       | object_spec FILL expr
+       | object_spec SHADED text
+       | object_spec COLORED text
+       | object_spec OUTLINED text
+       | object_spec CHOP
+       | object_spec CHOP expr
+       | object_spec SAME
+       | object_spec INVISIBLE
+       | object_spec LEFT_ARROW_HEAD
+       | object_spec RIGHT_ARROW_HEAD
+       | object_spec DOUBLE_ARROW_HEAD
+       | object_spec CW
+       | object_spec CCW
+       | object_spec text                                      %prec TEXT
+       | object_spec LJUST
+       | object_spec RJUST
+       | object_spec ABOVE
+       | object_spec BELOW
+       | object_spec THICKNESS expr
+       | object_spec ALIGNED
+       ;
+
+text:
+       TEXT
+       | SPRINTF '(' TEXT sprintf_args ')'
+       ;
+
+sprintf_args:
+       /* empty */
+       | sprintf_args ',' expr
+       ;
+
+position:
+       position_not_place
+       | place
+       ;
+
+position_not_place:
+       expr_pair
+       | position '+' expr_pair
+       | position '-' expr_pair
+       | '(' position ',' position ')'
+       | expr between position AND position
+       | expr '<' position ',' position '>'
+       ;
+
+between:
+       BETWEEN
+       | OF THE WAY BETWEEN
+       ;
+
+expr_pair:
+       expr ',' expr
+       | '(' expr_pair ')'
+       ;
+
+place:
+       /* line at A left == line (at A) left */
+       label                                                   %prec CHOP
+       | label corner
+       | corner label
+       | corner OF label
+       | HERE
+       ;
+
+label:
+       LABEL
+       | nth_primitive
+       | label '.' LABEL
+       ;
+
+ordinal:
+       ORDINAL
+       | '`' any_expr TH
+       ;
+
+optional_ordinal_last:
+       LAST
+       | ordinal LAST
+       ;
+
+nth_primitive:
+       ordinal object_type
+       | optional_ordinal_last object_type
+       ;
+
+object_type:
+       BOX
+       | CIRCLE
+       | ELLIPSE
+       | ARC
+       | LINE
+       | ARROW
+       | SPLINE
+       | '[' ']'
+       | TEXT
+       ;
+
+label_path:
+       '.' LABEL
+       | label_path '.' LABEL
+       ;
+
+relative_path:
+       corner                                                  %prec CHOP
+       /* give this a lower precedence than LEFT and RIGHT so that
+          [A: box] with .A left == [A: box] with (.A left) */
+       | label_path                                            %prec TEXT
+       | label_path corner
+       ;
+
+path:
+       relative_path
+       | '(' relative_path ',' relative_path ')'
+               {}
+       /* The rest of these rules are a compatibility sop. */
+       | ORDINAL LAST object_type relative_path
+       | LAST object_type relative_path
+       | ORDINAL object_type relative_path
+       | LABEL relative_path
+       ;
+
+corner:
+       DOT_N
+       | DOT_E
+       | DOT_W
+       | DOT_S
+       | DOT_NE
+       | DOT_SE
+       | DOT_NW
+       | DOT_SW
+       | DOT_C
+       | DOT_START
+       | DOT_END
+       | TOP
+       | BOTTOM
+       | LEFT
+       | RIGHT
+       | UPPER LEFT
+       | LOWER LEFT
+       | UPPER RIGHT
+       | LOWER RIGHT
+       | LEFT_CORNER
+       | RIGHT_CORNER
+       | UPPER LEFT_CORNER
+       | LOWER LEFT_CORNER
+       | UPPER RIGHT_CORNER
+       | LOWER RIGHT_CORNER
+       | NORTH
+       | SOUTH
+       | EAST
+       | WEST
+       | CENTER
+       | START
+       | END
+       ;
+
+expr:
+       VARIABLE
+       | NUMBER
+       | place DOT_X
+       | place DOT_Y
+       | place DOT_HT
+       | place DOT_WID
+       | place DOT_RAD
+       | expr '+' expr
+       | expr '-' expr
+       | expr '*' expr
+       | expr '/' expr
+       | expr '%' expr
+       | expr '^' expr
+       | '-' expr                                              %prec '!'
+       | '(' any_expr ')'
+       | SIN '(' any_expr ')'
+       | COS '(' any_expr ')'
+       | ATAN2 '(' any_expr ',' any_expr ')'
+       | LOG '(' any_expr ')'
+       | EXP '(' any_expr ')'
+       | SQRT '(' any_expr ')'
+       | K_MAX '(' any_expr ',' any_expr ')'
+       | K_MIN '(' any_expr ',' any_expr ')'
+       | INT '(' any_expr ')'
+       | RAND '(' any_expr ')'
+       | RAND '(' ')'
+       | SRAND '(' any_expr ')'
+       | expr '<' expr
+       | expr LESSEQUAL expr
+       | expr '>' expr
+       | expr GREATEREQUAL expr
+       | expr EQUALEQUAL expr
+       | expr NOTEQUAL expr
+       | expr ANDAND expr
+       | expr OROR expr
+       | '!' expr
+       ;
+]])
+
+# Pass plenty of options, to exercise plenty of code, even if we
+# don't actually check the output.  But SEGV is watching us, and
+# so might do dmalloc.
+AT_CHECK([[bison --verbose --defines input.y]], 0, [], [])
+
+AT_CLEANUP