import java.io.*; import java.lang.*; import java.util.*; // #DJDSTOP // # include "parm.h" // # include "stree/ststructs.mh" // # include "../stt/sttdefs.h" // // # include "../applinfer/precedence.h" // // /* // * Initialize the string table to contain various identifiers with // * builtin meanings and/or precedences. Then build trees to correspond // * to default signatures, as well as certain other standard subtrees. // */ // #DJDSTART class Initids { public static final int NLEVELS = 14; public static int indx_assign, /* precedence 0 */ indx_passign, indx_massign, /* cor precedence 1 */ /* cand precedence 2 */ /* other operators precedence 3 */ indx_or, /* precedence 4 */ indx_and, /* precedence 5 */ indx_not, /* precedence 6 */ indx_equals, /* precedence 7 */ indx_less, indx_le, indx_ge, indx_ne, indx_greater, indx_plus, /* precedence 8 */ indx_minus, indx_times, /* precedence 9 */ indx_divide, indx_mod, indx_pconc, /* precedence 10 */ indx_sconc, indx_exp, /* precedence 11 */ indx_deref, /* precedence 12 */ indx_subscr, /* precedence 13 */ indx_New, /* no precedence */ indx_ValueOf, indx_First, indx_Last, indx_Pred, indx_Succ, indx_Ord, indx_OrdInv, indx_Card, indx_In, indx_Out, indx_put, indx_Callcc, indx_size, indx_ptr_New, indx_init_New, indx_empty, indx_standard, indx_inline; public static int[] pend = new int[NLEVELS]; /* pend[n] = last string table entry with precedence */ /* level n */ public static int indx_Boolean, indx_Void, indx_true, indx_false, indx_simple, indx_Null, indx_Mk; public static int indx_Integer, // indx_Void, indx_Array; public static Node sig_assign, sig_equals, sig_less, sig_greater, sig_New, sig_const, sig_ValueOf, sig_pconc, sig_sconc, sig_Signature; public static Node val_Boolean, val_Integer, val_Void; public static Node var_Void; public static LetterId sel_true_L, /* Trees for Boolean$true[] and Boolean$false[] */ sel_false_L, id_Boolean; /* Note that the last definition field needs to be */ public static ApplicationNode sel_true, /* Trees for Boolean$true[] and Boolean$false[] */ sel_false; // id_Boolean; /* Note that the last definition field needs to be */ /* set later */ public static Node id_Integer, id_Void, id_put, id_ValueOf, id_New, id_size, id_Null, id_times, id_plus, appl_Null; public static int yyvline; /* initialized here since it is incorporated into */ /* the structures created here. */ public static void initids() { ParameterNode var_param; ParameterNode val_param; // Node[] as_params, // two_params, // al_params; yyvline = 9999; /* initialize string table indicees */ Stt.stt_enter("?"); /* Make sure index 0 is not used */ indx_passign = Stt.stt_enter("+="); indx_massign = Stt.stt_enter("-="); indx_assign = pend[0] = Stt.stt_enter(":="); indx_or = pend[1] = pend[2] = pend[3] = pend[4] = Stt.stt_enter("or"); indx_and = pend[5] = Stt.stt_enter("and"); indx_not = pend[6] = Stt.stt_enter("not"); indx_equals = Stt.stt_enter("="); indx_less = Stt.stt_enter("<"); indx_le = Stt.stt_enter("<="); indx_ge = Stt.stt_enter(">="); indx_ne = Stt.stt_enter("<>"); indx_greater = pend[7] = Stt.stt_enter(">"); indx_plus = Stt.stt_enter("+"); indx_minus = pend[8] = Stt.stt_enter("-"); indx_times = Stt.stt_enter("*"); indx_divide = Stt.stt_enter("/"); indx_mod = pend[9] = Stt.stt_enter("%"); indx_pconc = Stt.stt_enter("^+"); indx_sconc = pend[10] = Stt.stt_enter("^*"); indx_exp = pend[11] = Stt.stt_enter("**"); indx_deref = pend[12] = Stt.stt_enter("^"); indx_subscr = pend[13] = Stt.stt_enter("."); indx_New = Stt.stt_enter("New"); indx_ptr_New = Stt.stt_enter("ptr_New"); indx_init_New = Stt.stt_enter("init_New"); indx_ValueOf = Stt.stt_enter("V"); indx_First = Stt.stt_enter("First"); indx_Last = Stt.stt_enter("Last"); indx_Pred = Stt.stt_enter("Pred"); indx_Succ = Stt.stt_enter("Succ"); indx_Ord = Stt.stt_enter("Ord"); indx_OrdInv = Stt.stt_enter("OrdInv"); indx_Card = Stt.stt_enter("Card"); indx_In = Stt.stt_enter("In"); indx_Out = Stt.stt_enter("Out"); indx_Boolean = Stt.stt_enter("Boolean"); indx_true = Stt.stt_enter("True"); indx_false = Stt.stt_enter("False"); indx_Integer = Stt.stt_enter("Short"); indx_Void = Stt.stt_enter("Void"); indx_Array = Stt.stt_enter("Array"); indx_put = Stt.stt_enter("put"); indx_Callcc = Stt.stt_enter("Callcc"); indx_size = Stt.stt_enter("size"); indx_empty = Stt.stt_enter("''"); indx_simple = Stt.stt_enter("simple"); indx_standard = Stt.stt_enter("standard"); indx_inline = Stt.stt_enter("inline"); indx_Mk = Stt.stt_enter("Mk"); indx_Null = Stt.stt_enter("Null"); id_Boolean = new LetterId(Const.LETTERID, indx_Boolean); id_Void = new LetterId(Const.LETTERID, indx_Void); id_Integer = new LetterId(Const.LETTERID, indx_Integer); id_put = new LetterId(Const.LETTERID, indx_put); id_ValueOf = new LetterId(Const.LETTERID, indx_ValueOf); id_New = new LetterId(Const.LETTERID, indx_New); id_size = new LetterId(Const.LETTERID, indx_size); id_Null = new LetterId(Const.LETTERID, indx_Null); id_times = new LetterId(Const.LETTERID, indx_times); id_plus = new LetterId(Const.LETTERID, indx_plus); /* initialize default signatures */ /* Note that since these can and will be shared they should not */ /* be touched by the symbol table routine */ val_Boolean = Mine.lock( new ValSignature(Const.VALSIGNATURE, id_Boolean) ); val_Integer = Mine.lock( new ValSignature(Const.VALSIGNATURE, id_Integer) ); val_Void = Mine.lock( new ValSignature(Const.VALSIGNATURE, id_Void) ); var_Void = Mine.lock( new VarSignature(Const.VARSIGNATURE, id_Void) ); val_param = new ParameterNode(Const.PARAMETER, null, new ValSignature(Const.VALSIGNATURE, new LetterId(Const.LETTERID,-1) ) ) ; var_param = new ParameterNode(Const.PARAMETER, null, new VarSignature(Const.VARSIGNATURE, new LetterId(Const.LETTERID,-1) ) ) ; Node[] as_params = new Node[] {var_param, val_param}; Node[] two_params = new Node[] {val_param, val_param}; Node[] al_params = new Node[] {var_param, var_param}; // as_params = Mine.lock( mklist(var_param, val_param, -1) ); // two_params = Mine.lock( mklist(val_param, val_param, -1) ); // al_params = Mine.lock(mklist(var_param, var_param, -1) ); sig_assign = Mine.lock( new FSignature(Const.FUNCSIGNATURE, null /* inline */, as_params, val_param.par_signature) ); sig_pconc = sig_sconc = Mine.lock( new FSignature(Const.FUNCSIGNATURE, null, two_params, val_param . par_signature)); sig_equals = sig_less = sig_greater = Mine.lock( new FSignature(Const.FUNCSIGNATURE, null, two_params,val_Boolean) ); sig_New = Mine.lock( new FSignature(Const.FUNCSIGNATURE, null, new ParserVal(ListHeaderNode.emptylist()).NodelstCvt(), var_param. par_signature) ); sig_const = Mine.lock( new FSignature(Const.FUNCSIGNATURE, null, new ParserVal(ListHeaderNode.emptylist()).NodelstCvt(), val_param.par_signature) ); sig_ValueOf = Mine.lock( new FSignature(Const.FUNCSIGNATURE, null, new ParameterNode[] {var_param}, val_param.par_signature) ); sig_Signature = Mine.lock(new SignatureSigNode(Const.SIGNATURESIG)); sel_true_L = new LetterId(Const.LETTERID,indx_true); Mine.initfld(sel_true_L.sel_type,id_Boolean); sel_true = new ApplicationNode(Const.APPLICATION, sel_true_L,new ParserVal(ListHeaderNode.emptylist()).NodelstCvt()); Mine.lock( sel_true ); sel_false_L = new LetterId(Const.LETTERID,indx_false); Mine.initfld(sel_false_L.sel_type,id_Boolean); sel_false = new ApplicationNode(Const.APPLICATION, sel_false_L,new ParserVal( ListHeaderNode.emptylist()).NodelstCvt()); Mine.lock( sel_false ); appl_Null = new ApplicationNode(Const.APPLICATION, id_Null,new ParserVal( ListHeaderNode.emptylist()).NodelstCvt()); yyvline = 0; } }