`*-----------------------------------*`

`*           >>>Pico 2.0<<<          *`

`*         Wolfgang De Meuter        *`

`*  VUB Programming Technology Lab   *`

`*               2004               *`

`*-----------------------------------*`

`*  Meta Programming Abstractions    *`

`*-----------------------------------*`

{ META():{

  TAG(exp())::tag(get(exp,3));

  VOI_TAG::00;

  REF_TAG::01;

  APL_TAG::02;

  TBL_TAG::03;

  QUA_TAG::04;

  DCL_TAG::05;

  DEF_TAG::06;

  SET_TAG::07;

  CST_TAG::08;

  VAR_TAG::09;

  CNT_TAG::10;

  NAT_TAG::11;

  FUN_TAG::12;

  TAB_TAG::13;

  TXT_TAG::14;

  FRC_TAG::15;

  NBR_TAG::32;

  VOI()           ::make(VOI_TAG);

  REF(nam)        ::make(REF_TAG,nam);

  APL(fun,arg)    ::make(APL_TAG,fun,arg);

  TBL(tbl,idx)    ::make(TBL_TAG,tbl,idx);

  QUA(exp,inv)    ::make(QUA_TAG,exp,inv);

  DCL(inv,exp)    ::make(DCL_TAG,inv,exp);

  DEF(inv,exp)    ::make(DEF_TAG,inv,exp);

  SET(inv,exp)    ::make(SET_TAG,inv,exp);

  CST(nam,val,old)::make(CST_TAG,nam,val,old);

  VAR(nam,val,old)::make(VAR_TAG,nam,val,old);

  NAT(nat)        ::make(NAT_TAG,nat);

  FUN(nam,arg,bod,dct)::make(FUN_TAG,nam,arg,bod,dct);

  TAB@els         ::{ i:-1;

                      t[size(els)+1]:if((i:=i+1)=0,TAB_TAG,els[i]);

                      make@t };

  TXT(txt)        ::make(TXT_TAG,txt);

  FRC(frc)        ::make(FRC_TAG,frc);

  QUO(exp)        ::make(QUO_TAG,exp);

  NBR(num)        ::make(NBR_TAG,num);

  is_VOI(e)::tag(e)=VOI_TAG;

  is_REF(e)::tag(e)=REF_TAG;

  is_APL(e)::tag(e)=APL_TAG;

  is_TBL(e)::tag(e)=TBL_TAG;

  is_QUA(e)::tag(e)=QUA_TAG;

  is_DCL(e)::tag(e)=DCL_TAG;

  is_DEF(e)::tag(e)=DEF_TAG;

  is_SET(e)::tag(e)=SET_TAG;

  is_CST(e)::tag(e)=CST_TAG;

  is_VAR(e)::tag(e)=VAR_TAG;

  is_NAT(e)::tag(e)=NAT_TAG;

  is_FUN(e)::tag(e)=FUN_TAG;

  is_TAB(e)::tag(e)=TAB_TAG;

  is_TXT(e)::tag(e)=TXT_TAG;

  is_FRC(e)::tag(e)=FRC_TAG;

  is_QUO(e)::tag(e)=QUO_TAG;

  is_NRB(e)::tag(e)=NBR_TAG;

  REF_NAM(ref)     ::get(ref,1);

  REF_NAM_(ref,nam)::set(ref,1,nam);

  APL_NAM(apl)     ::get(apl,1);

  APL_PAR(apl)     ::get(apl,2);

  APL_NAM_(apl,nam)::set(apl,1,nam);

  APL_PAR_(apl,par)::set(apl,2,par);

  TBL_NAM(tbl)     ::get(tbl,1);

  TBL_IDX(tbl)     ::get(tbl,2);

  TBL_NAM_(tbl,nam)::set(tbl,1,nam);

  TBL_IDX_(tbl,idx)::set(tbl,2,idx);

  QUA_EXP(qua)     ::get(qua,1);

  QUA_INV(qua)     ::get(qua,2);

  QUA_EXP_(qua,inv)::set(qua,1,inv);

  QUA_INV_(qua,exp)::set(qua,2,exp);

  DCL_EXP(dcl)     ::get(dcl,1);

  DCL_INV(dcl)     ::get(dcl,2);

  DCL_INV_(dcl,inv)::set(dcl,1,inv);

  DCL_EXP_(dcl,exp)::set(dcl,2,exp);

  DEF_EXP(def)     ::get(def,1);

  DEF_INV(def)     ::get(def,2);

  DEF_INV_(def,inv)::set(def,1,inv);

  DEF_EXP_(def,exp)::set(def,2,exp);

  SET_EXP(def)     ::get(def,1);

  SET_INV(def)     ::get(def,2);

  SET_INV_(def,inv)::set(def,1,inv);

  SET_EXP_(def,exp)::set(def,2,exp);

  DCT_NAM(dct)     ::get(dct,1); ` DCT = VAR + CST

  DCT_VAL(dct)     ::get(dct,2);

  DCT_DCT(dct)     ::get(dct,3);

  DCT_NAM_(dct,nam)::set(dct,1,nam);

  DCT_VAL_(dct,val)::set(dct,2,val);

  DCT_DCT_(dct,nxt)::set(dct,3,nxt);

  VAR_NAM          ::DCT_NAM;

  VAR_VAL          ::DCT_VAL;

  VAR_DCT          ::DCT_DCT;

  VAR_NAM_         ::DCT_NAM_;

  VAR_VAL_         ::DCT_VAL_;

  VAR_DCT_         ::DCT_DCT_;

  CST_NAM          ::DCT_NAM;

  CST_VAL          ::DCT_VAL;

  CST_DCT          ::DCT_DCT;

  CST_NAM_         ::DCT_NAM_;

  CST_VAL_         ::DCT_VAL_;

  CST_DCT_         ::DCT_DCT_;

  NAT_NAT(nat)     ::get(nat,1);

  NAT_NAT_(nat,fct)::set(nat,1,fct);

  FUN_NAM(fun)     ::get(fun,1);

  FUN_PAR(fun)     ::get(fun,2);

  FUN_BOD(fun)     ::get(fun,3);

  FUN_DCT(fun)     ::get(fun,4);

  FUN_NAM_(fun,nam)::set(fun,1,nam);

  FUN_PAR_(fun,par)::set(fun,2,par);

  FUN_BOD_(fun,bod)::set(fun,3,bod);

  FUN_DCT_(fun,dct)::set(fun,4,dct);

  TAB_IDX(tab,idx) ::get(tab,idx);

  TAB_IDX_(tab,idx,exp)::set(tab,idx,exp);

  TXT_TXT(txt)     ::get(txt,1);

  TXT_TXT_(txt,str)::set(txt,1,str);

  FRC_FRC(frc)     ::get(frc,1);

  FRC_FRC_(frc,flo)::set(frc,1,flo);

  NBR_NBR(nbr)     ::get(nbr,1);

  NBR_NBR_(nbr,itr)::set(nbr,1,itg);

  TXT_TXT(txt)     ::get(txt,1);

  TXT_TXT_(txt,str)::set(txt,1,str);

  QUO_QUO(quo)     ::get(quo,1);

  QUO_QUO_(quo,exp)::set(quo,1,exp);

  capture() };

  META:=META();

  display("Meta Abstractions loaded",eoln)

}