$include "defs.icn"
$include "global_vars.icn"

procedure special(tp,val) 
    ior(ishift(tp , 26) , val)
end

procedure mklist( va_alist )
    local i,p,l
    yyinfo("mklist va_alist")
    nodeinfo("mklist va_alist")
    listinfo("mklist va_alist")
    consinfo("mklist va_alist")


    lists_total_cnt +:= 1
    lists_made_cnt +:= 1
    l := emptylist()
    
    every (p := !va_alist) do {
	nodeinfo("mklist type p = " || dump_info(p))
	yyinfo("mklist type p = " || dump_info(p))
	if \p then {
	    p.dump()
	}
	consinfo("mklist l before addright(l,p)")
	if \l then
	    l.cons_dump()
	else
	    consinfo("l nil")
	consinfo("mklist p before addright(l,p)")
	if \p then
	    p.cons_dump()
	else
	    consinfo("mklist p nil")
        addright(l,p)
	consinfo("mklist l after addright(l,p)")
	if \l then
	    l.cons_dump()
	else
	    consinfo("mklist l nil")
    }
    consinfo("mklist done")
	if \l then
	    l.cons_dump()
	else
	    consinfo("l nil")
    return l 
end
procedure emptylist() 
    nodeinfo("Creating emptylist")
    listinfo("Creating emptylist")
   
    ret := mknode([LISTHEADER,nil,nil])
    ret.dump() 
    return ret
end

#DJDSTOP
procedure cn_cons(hd,tl)
    local p
    listinfo("cn_cons")

    p := ConsNode(hd,tl)
    return p
end
#DJDSTART
procedure is_list(l)
    if (/l) then fail
    if l.kind = LISTHEADER 
    then return
    else fail
end


procedure is_empty(l)
    if /l then {
	nodeinfo("is empty TRUE")
	listinfo("is empty TRUE")
	return
    }
    if /l.lh_first then {
	nodeinfo("is empty l.lh_first TRUE")
	listinfo("is empty l.lh_first TRUE")
	return
    }
    nodeinfo("is empty lh_first - FALSE")
    listinfo("is empty lh_first - FALSE")
    fail
end

procedure split(kindno, id_list, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 , arg10)
    local vrtx,  result, p, ptr
    # Build a node with the id pointed to by p in the id field */
	# end add it to the result.                                 */
	result := emptylist()
    listinfo("IN SPLIT")
    nodeinfo("IN SPLIT")
    ptr := id_list.cn_hd_field
    while \ptr  do {
	p :=  ptr.cn_hd_field
	{
	    yyinfo("listops split kindno = " || kindno)
            case ( argcnt_from_kind[kindno + 1])  of {
		0: vrtx := mknode([kindno])
		1: vrtx := mknode([kindno, p])
		2: vrtx := mknode([kindno, p, arg1])
                3: vrtx := mknode([ kindno, p ,arg1, arg2])
		4: vrtx := mknode([kindno, p, arg1, arg2, arg3])
		5: vrtx := mknode([kindno,p, arg1, arg2, arg3, arg4])
                6: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5 ])
                7: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6 ])
                8: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6,arg7 ])
                9: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6, arg7. arg8 ])
                10: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ])
                11: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg7, arg9, ag10 ])
                default: rpt_err("split: bad node size: kind =  " ||  kindno)
            }
            addright(result, vrtx)
	} 
	
	ptr := p.cn_tl_field 
    }

    nodeinfo("Split")
    result.dump()
    return ( result )
end
procedure conc(l1,l2)
    if ( is_empty(l1) ) then
	{ 
	    vfree(l1)
	    return(l2)
	}
    if ( not(is_empty(l2)) )  then 
	{
	    l1.lh_last.cn_tl_field := l2.lh_first
	    l1.lh_last := l2.lh_last
	}
    # free l2. Note that vfree cannot be used without clearing the first */
	# last fields since the cons nodes are being reused. */ 
        l2 .lh_last := l2 .lh_first := nil
    vfree(l2)
    return ( l1 )
end
#
# Add node e at end of list l.
# If e is nil do nothing.
#
procedure addleft(l,e)
local p
listinfo("addleft dump_info(e) = " || dump_info(e))
nodeinfo("addleft dump_info(e) = " || dump_info(e))

if ( /e ) then return l
# p := ListHeaderNode(nil, nil, lock(e), nil)
if( is_empty(l) ) then {
p := ConsNode(lock(e),nil)
l.lh_first :=  p
l.lh_last := p
} else {
l.lh_first := ConsNode(lock(e),l.lh_first)
}
consinfo("addleft return")
l.cons_dump()
return  l
end
#
# add node e at beginning of list l.
# if e is NIL do nothing
# return l
#
procedure addright(l,e)
    local p
    listinfo("addright dump_info(e) = " || dump_info(e))
    nodeinfo("addright dump_info(e) = " || dump_info(e))
    if (/e) then {
	nodeinfo("addright 1 return l type l = " || dump_info(l)) 
	listinfo("addright 1 return l type l = " || dump_info(l)) 
	return l
    }
    p := ConsNode(lock(e),nil)
    nodeinfo("addright 2 p = " || dump_info(p)) 
    listinfo("addright 2 p = " || dump_info(p))
    p.dump()
    if ( is_empty(l) ) then {
	nodeinfo("addright 3 l = empty" || dump_info(l)) 
	listinfo("addright 3 l = empty" || dump_info(l)) 
	l.lh_first := p
	l.lh_last :=  p
	nodeinfo("addright - in next node lh first & last should equal p above")
	listinfo("addright - in next node lh first & last should equal p above")
	l.dump()
    } else {

	l.lh_last.cn_tl_field := p
	l.lh_last := p
	listinfo("addright - in next node lh last.cn_tl_field should equal p above")
	nodeinfo("addright - in next node lh last.cn_tl_field should equal p above")
	l.lh_last.dump()
	nodeinfo("addright - in next node lh last should equal p above")

	l.dump()


    }
    consinfo("addright return")
    l.cons_dump()
    return l
end

#############################################################################
class Node(kind,vlineno,pre_num,post_num)
method dump()
{ # SignatureSig
	    nodeinfo(left("kind   = ",40) || self.kind)
	    nodeinfo(left("vlineno   = ",40) || dump_info(self.vlineno))
	    nodeinfo(left("pre_num   = ",40) || dump_info(self.pre_num))
	    nodeinfo(left("post_num   = ",40) || dump_info(self.post_num))
	}
end
initially (knd, line, pre, post) 
{
kind := knd
vlineno := line
pre_num := pre
post_num := post
}
end

############################################################################

class ConsNode(unique_id,cn_hd_field,cn_tl_field)
method dump()
{ # SignatureSig
	    nodeinfo(left("cn_hd_field   = ",40) || dump_info(self.cn_hd_field))
	    nodeinfo(left("cn_tl_field   = ",40) || dump_info(self.cn_tl_field))
	    nodeinfo(left("Unique Id   = ",40) || dump_info(self.unique_id))
	}
end
method cons_dump()
{ # SignatureSig
	    consinfo(left("cn_hd_field   = ",40) || dump_info(self.cn_hd_field))
	    consinfo(left("cn_tl_field   = ",40) || dump_info(self.cn_tl_field))
	    consinfo(left("Unique Id   = ",40) || dump_info(self.unique_id))
	}
end


#DJDSTOP
method head()
return cn_hd_field
end
method tail()
return cn_tl_field
end
method cn_sethead(hd)
listinfo("cn_sethead")
cn_hd_field := hd
end
method cn_settail(tl)
listinfo("cn_settail")
cn_hd_field := tl
end
#DJDSTART

initially(cn_hd,cn_tl)
{
cn_tl_field := cn_tl
cn_hd_field := cn_hd

unique_node_id +:= 1
unique_id := unique_node_id
}
end

###########################################################################

class ListHeaderNode : Node : ConsNode (lh_first,lh_last,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump ()
{ # DeclarationNode
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("lh_first   = ",40) || dump_info(self.lh_first))
	    nodeinfo(left("lh_last   = ",40) || dump_info(self.lh_last))
}
end
method list_dump ()
{ # DeclarationNode
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("lh_first   = ",40) || dump_info(self.lh_first))
	    nodeinfo(left("lh_last   = ",40) || dump_info(self.lh_last))
}
end


method first()
return self.lh_first
end


method  last() 
return self.lh_last
end

method setfirst(p)
lh_first := p
end
method setlast(p)
lh_last := p
end



# 
#     conc(l1,l2)
#
#  Destructively appends l1 to l2 and returns the result.
#   l1 becomes the result. l2 is destroyed.
#
# 
method conc(l2)
if (is_empty(self) ) then 
    {
return(l2)
}
if ( not is_empty(l2) ) then 
    {
self.cn_tl_field.cn_settail(l2.cn_hd_field)
self.cn_settail(l2.cn_tl_field)
}
l2 := l2.hd_field := l2.tl_field := nil
# free l2. Note that vfree cannot be used without clearing the first 
# last fields since the cons nodes are being reused. 
l2.lh_last := l2.lh_first := nil
vfree(l2)
return (self)
end

#
# length(l)
# 
#  assuming l is a list
#    return the number of elements in it
# 
method  length()
local count, v, tmp
listinfo("IN LENGTH")
count := 0
listinfo("length count = " || count || "dump_info(self.lh_first) = " || (dump_info(self.lh_first)))

tmp := self.lh_first
while \tmp  do {
v := tmp.cn_hd_field
count +:= 1
tmp := tmp.cn_tl_field
listinfo("length count = " || count || "dump_info(v) = " || dump_info(v))
}
return ( count )
end
#
#  list_to_array(l)
# 
#  input: A list l.
# 
#  output: An array containing pointers to the elements of l.
#          The elements of l are locked.
#          l is vfreed (but unaffected if it has nonzero reference count).
# 
method list_to_array()
local    a, len, tmp, v, it, count
len := self.length()
it := list(len + 1)
count := 0
listinfo("list_to_array count = " || count || "dump_info(self.lh_first) = " || (dump_info(self.lh_first)))
tmp := self.lh_first
listinfo("list to array len = " || len || " tmp = " || dump_info(tmp))
while \tmp  do {
v := tmp.cn_hd_field
count +:= 1
listinfo("list to array count = " || count || " v = " || dump_info(v))
it[count] := v
tmp := tmp.cn_tl_field
}
a := Array(len,it)
return ( a )
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(nil,nil)



end
##############################################################################
class DeclarationNode  : Node : ConsNode(decl_id,decl_denotation,displacement,level,decl_signature,decl_done,decl_sig_transp,decl_innermost_id,decl_previous_definition,decl_scope,decl_can_be_refd,decl_special,decl_sel_index,decl_needed,decl_const_val,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump ()
{ # DeclarationNode
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("decl_id   = ",40) || dump_info(self.decl_id))
	    nodeinfo(left("decl_denotation   = ",40) || dump_info(self.decl_denotation))
	    nodeinfo(left("displacement   = ",40) || dump_info(self.displacement))
	    nodeinfo(left("level   = ",40) || dump_info(self.level))
	    nodeinfo(left("decl_signature   = ",40) || dump_info(self.decl_signature))
	    nodeinfo(left("decl_done   = ",40) || dump_info(self.decl_done))
	    nodeinfo(left("decl_sig_transp   = ",40) || dump_info(self.decl_sig_transp))
	    nodeinfo(left("decl_innermost_id   = ",40) || dump_info(self.decl_innermost_id))
	    nodeinfo(left("decl_previous_definition   = ",40) || dump_info(self.decl_previous_definition))
	    nodeinfo(left("decl_scope   = ",40) || dump_info(self.decl_scope))
	    nodeinfo(left("decl_can_be_refd   = ",40) || dump_info(self.decl_can_be_refd))
	    nodeinfo(left("decl_special   = ",40) || dump_info(self.decl_special))
	    nodeinfo(left("decl_sel_index   = ",40) || dump_info(self.decl_sel_index))
	    nodeinfo(left("decl_needed   = ",40) || dump_info(self.decl_needed))
	    nodeinfo(left("decl_const_val   = ",40) || dump_info(self.decl_const_val))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class ParameterNode : Node : ConsNode(par_id,par_signature,displacement,level,par_previous_definition,par_scope,par_only_def,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # Parameter
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("par_id   = ",40) || dump_info(self.par_id))
	    nodeinfo(left("par_signature   = ",40) || dump_info(self.par_signature))
	    nodeinfo(left("displacement   = ",40) || dump_info(self.displacement))
	    nodeinfo(left("level   = ",40) || dump_info(self.level))
	    nodeinfo(left("par_previous_definition   = ",40) || dump_info(self.par_previous_definition))
	    nodeinfo(left("par_scope   = ",40) || dump_info(self.par_scope))
	    nodeinfo(left("par_only_def   = ",40) || dump_info(self.par_only_def))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class RElementNode : Node : ConsNode(re_id,re_denotation,re_New_index,re_ValueOf_index,re_assign_index,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)

method dump()
{ # RElement
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("re_id   = ",40) || dump_info(self.re_id))
	    nodeinfo(left("re_denotation   = ",40) || dump_info(self.re_denotation))
	    nodeinfo(left("re_New_index   = ",40) || dump_info(self.re_New_index))
	    nodeinfo(left("re_ValueOf_index   = ",40) || dump_info(self.re_ValueOf_index))
	    nodeinfo(left("re_assign_index   = ",40) || dump_info(self.re_assign_index))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class VarSignature : Node : ConsNode(signature,sig_done,var_denotation,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # VarSignature
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("var_denotation   = ",40) || dump_info(self.var_denotation))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class ValSignature : Node : ConsNode(signature,sig_done,val_denotation,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)

method dump()
{ # ValSignature
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("val_denotation   = ",40) || dump_info(self.val_denotation))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class FSignature : Node : ConsNode(signature,sig_done,fsig_construction,fsig_special,fsig_slink_known,fsig_inline_code,fsig_param_list,fsig_result_sig,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # FSignature
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("fsig_construction   = ",40) || dump_info(self.fsig_construction))
	    nodeinfo(left("fsig_special   = ",40) || dump_info(self.fsig_special))
	    nodeinfo(left("fsig_slink_known   = ",40) || dump_info(self.fsig_slink_known))
	    nodeinfo(left("fsig_inline_code   = ",40) || dump_info(self.fsig_inline_code))
	    nodeinfo(left("fsig_param_list   = ",40) || dump_info(self.fsig_param_list))
	    nodeinfo(left("fsig_result_sig   = ",40) || dump_info(self.fsig_result_sig))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class TSignature : Node : ConsNode(signature,sig_done,ts_simple_type,ts_local_type_id,ts_clist,ts_previous_definition,ts_const_code,ts_string_code,ts_element_code,ts_string_max,ts_meta_concat,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # TSignature
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("ts_simple_type   = ",40) || dump_info(self.ts_simple_type))
	    nodeinfo(left("ts_local_type_id   = ",40) || dump_info(self.ts_local_type_id))
	    nodeinfo(left("ts_clist   = ",40) || dump_info(self.ts_clist))
	    nodeinfo(left("ts_previous_definition   = ",40) || dump_info(self.ts_previous_definition))
	    nodeinfo(left("ts_const_code   = ",40) || dump_info(self.ts_const_code))
	    nodeinfo(left("ts_string_code   = ",40) || dump_info(self.ts_string_code))
	    nodeinfo(left("ts_element_code   = ",40) || dump_info(self.ts_element_code))
	    nodeinfo(left("ts_string_max   = ",40) || dump_info(self.ts_string_max))
	    nodeinfo(left("ts_meta_concat   = ",40) || dump_info(self.ts_meta_concat))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class TSComponentNode : Node : ConsNode(tsc_id,tsc_signature,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # TSComponent
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("tsc_id   = ",40) || dump_info(self.tsc_id))
	    nodeinfo(left("tsc_signature   = ",40) || dump_info(self.tsc_signature))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class DefCharSigNode : Node : ConsNode(dcs_0,dcs_1,dcs_2,dcs_3,dcsexceptions,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # DefCharSig
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("dcs_0   = ",40) || dump_info(self.dcs_0))
	    nodeinfo(left("dcs_1   = ",40) || dump_info(self.dcs_1))
	    nodeinfo(left("dcs_2   = ",40) || dump_info(self.dcs_2))
	    nodeinfo(left("dcs_3   = ",40) || dump_info(self.dcs_3))
	    nodeinfo(left("dcsexceptions   = ",40) || dump_info(self.dcsexceptions))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end

class SignatureSigNode : Node : ConsNode(signature,sig_done,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # SignatureSig
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class BlDenotationNode : Node : ConsNode(signature,sig_done,ar_size,ar_static_link,ar_static_level,bld_declaration_list,bld_den_seq,bld_precedence,bld_flags,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # BlDenotation
self$Node.dump()
self$ConsNode.dump()

	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("ar_size   = ",40) || dump_info(self.ar_size))
	    nodeinfo(left("ar_static_link   = ",40) || dump_info(self.ar_static_link))
	    nodeinfo(left("ar_static_level   = ",40) || dump_info(self.ar_static_level))
	    nodeinfo(left("bld_declaration_list   = ",40) || dump_info(self.bld_declaration_list))
	    nodeinfo(left("bld_den_seq   = ",40) || dump_info(self.bld_den_seq))
	    nodeinfo(left("bld_precedence   = ",40) || dump_info(self.bld_precedence))
	    nodeinfo(left("bld_flags   = ",40) || dump_info(self.bld_flags))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class UseListNode : Node : ConsNode(signature,sig_done,usl_type_list,usl_den_seq,usl_previous_list,usl_precedence,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # UseList
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("usl_type_list   = ",40) || dump_info(self.usl_type_list))
	    nodeinfo(left("usl_den_seq   = ",40) || dump_info(self.usl_den_seq))
	    nodeinfo(left("usl_previous_list   = ",40) || dump_info(self.usl_previous_list))
	    nodeinfo(left("usl_precedence   = ",40) || dump_info(self.usl_precedence))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class ApplicationNode : Node : ConsNode(signature,sig_done,ap_operator,ap_args,ap_void_decl,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # Application
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("ap_operator   = ",40) || dump_info(self.ap_operator))
	    nodeinfo(left("ap_args   = ",40) || dump_info(self.ap_args))
	    nodeinfo(left("ap_void_decl   = ",40) || dump_info(self.ap_void_decl))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)



end
class EnumerationNode : Node : ConsNode(signature,sig_done,enum_id_list,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # Enumeration
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("enum_id_list   = ",40) || dump_info(self.enum_id_list))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)



end
class ExtensionNode : Node : ConsNode(signature,sig_done,ext_denotation,In_index,Out_index,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # Extension
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("ext_denotation   = ",40) || dump_info(self.ext_denotation))
	    nodeinfo(left("In_index   = ",40) || dump_info(self.In_index))
	    nodeinfo(left("Out_index   = ",40) || dump_info(self.Out_index))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)



end
class ProductNode : Node : ConsNode(signature,sig_done,prod_local_type_id,prod_components,prod_previous_definition,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # Product
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("prod_local_type_id   = ",40) || dump_info(self.prod_local_type_id))
	    nodeinfo(left("prod_components   = ",40) || dump_info(self.prod_components))
	    nodeinfo(left("prod_previous_definition   = ",40) || dump_info(self.prod_previous_definition))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)



end
class RecordConstructionNode : Node : ConsNode(signature,sig_done,rec_component_list,rec_previous_definition,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # RecordConstruction
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("rec_component_list   = ",40) || dump_info(self.rec_component_list))
	    nodeinfo(left("rec_previous_definition   = ",40) || dump_info(self.rec_previous_definition))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class UnionConstructionNode : Node : ConsNode(signature,sig_done,prod_local_type_id,prod_components,prod_previous_definition,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # UnionConstruction
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("prod_local_type_id   = ",40) || dump_info(self.prod_local_type_id))
	    nodeinfo(left("prod_components   = ",40) || dump_info(self.prod_components))
	    nodeinfo(left("prod_previous_definition   = ",40) || dump_info(self.prod_previous_definition))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)



end
class WithListNode : Node : ConsNode(wl_local_type_id,wl_component_list,wl_previous_definition,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()

{ # WithList
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("wl_local_type_id   = ",40) || dump_info(self.wl_local_type_id))
	    nodeinfo(left("wl_component_list   = ",40) || dump_info(self.wl_component_list))
	    nodeinfo(left("wl_previous_definition   = ",40) || dump_info(self.wl_previous_definition))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class ModPrimaryNode : Node : ConsNode(signature,sig_done,displacement,level,mp_primary,mp_type_modifier,mp_delete_v,mp_orig_length,mp_needed,mp_no_surr_loop,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # ModPrimary
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("displacement   = ",40) || dump_info(self.displacement))
	    nodeinfo(left("level   = ",40) || dump_info(self.level))
	    nodeinfo(left("mp_primary   = ",40) || dump_info(self.mp_primary))
	    nodeinfo(left("mp_type_modifier   = ",40) || dump_info(self.mp_type_modifier))
	    nodeinfo(left("mp_delete_v   = ",40) || dump_info(self.mp_delete_v))
	    nodeinfo(left("mp_orig_length   = ",40) || dump_info(self.mp_orig_length))
	    nodeinfo(left("mp_needed   = ",40) || dump_info(self.mp_needed))
	    nodeinfo(left("mp_no_surr_loop   = ",40) || dump_info(self.mp_no_surr_loop))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class ExportListNode : Node : ConsNode(el_local_type_id,el_export_element_list,el_previous_definition,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # ExportList
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("el_local_type_id   = ",40) || dump_info(self.el_local_type_id))
	    nodeinfo(left("el_export_element_list   = ",40) || dump_info(self.el_export_element_list))
	    nodeinfo(left("el_previous_definition   = ",40) || dump_info(self.el_previous_definition))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)
end
class HideListNode : Node : ConsNode(el_local_type_id,el_export_element_list,el_previous_definition,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # HideList
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("el_local_type_id   = ",40) || dump_info(self.el_local_type_id))
	    nodeinfo(left("el_export_element_list   = ",40) || dump_info(self.el_export_element_list))
	    nodeinfo(left("el_previous_definition   = ",40) || dump_info(self.el_previous_definition))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)



end
class ExportElementNode : Node : ConsNode(ee_id,ee_signature,ee_export_list,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # ExportElement
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("ee_id   = ",40) || dump_info(self.ee_id))
	    nodeinfo(left("ee_signature   = ",40) || dump_info(self.ee_signature))
	    nodeinfo(left("ee_export_list   = ",40) || dump_info(self.ee_export_list))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class AllConstantsNode(kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # AllConstantsNode
self$Node.dump()
self$ConsNode.dump()
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class WordElseNode : Node : ConsNode(signature,sig_done,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # WordElse
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class WordCandNode : Node : ConsNode (kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dumo()
 { # WordCand
self$Node.dump()
self$ConsNode.dump()
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class WordCorNode : Node : ConsNode (kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # WordCor
self$Node.dump()
self$ConsNode.dump()
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class GuardedListNode : Node : ConsNode(signature,sig_done,gl_list,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # GuardedList
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("gl_list   = ",40) || dump_info(self.gl_list))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class LoopDenotationNode : Node : ConsNode(signature,sig_done,gl_list,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # LoopDenotation
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("gl_list   = ",40) || dump_info(self.gl_list))
	}
end

initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class GuardedElementNode : Node : ConsNode(ge_guard,ge_element,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # GuardedElement
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("ge_guard   = ",40) || dump_info(self.ge_guard))
	    nodeinfo(left("ge_element   = ",40) || dump_info(self.ge_element))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class OpridNode : Node : ConsNode(signature,sig_done,sel_type,id_str_table_index,id_use_list,id_last_definition,id_def_found,sel_index,id_appl,id_forward_ref,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # Oprid
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("sel_type   = ",40) || dump_info(self.sel_type))
	    nodeinfo(left("id_str_table_index   = ",40) || dump_info(self.id_str_table_index))
	    nodeinfo(left("id_use_list   = ",40) || dump_info(self.id_use_list))
	    nodeinfo(left("id_last_definition   = ",40) || dump_info(self.id_last_definition))
	    nodeinfo(left("id_def_found   = ",40) || dump_info(self.id_def_found))
	    nodeinfo(left("sel_index   = ",40) || dump_info(self.sel_index))
	    nodeinfo(left("id_appl   = ",40) || dump_info(self.id_appl))
	    nodeinfo(left("id_forward_ref   = ",40) || dump_info(self.id_forward_ref))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class LetterId : Node : ConsNode(signature,sig_done,sel_type,id_str_table_index,id_use_list,id_last_definition,id_def_found,sel_index,id_appl,id_forward_ref,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # LetterId
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("sel_type   = ",40) || dump_info(self.sel_type))
	    nodeinfo(left("id_str_table_index   = ",40) || dump_info(self.id_str_table_index))
	    nodeinfo(left("id_use_list   = ",40) || dump_info(self.id_use_list))
	    nodeinfo(left("id_last_definition   = ",40) || dump_info(self.id_last_definition))
	    nodeinfo(left("id_def_found   = ",40) || dump_info(self.id_def_found))
	    nodeinfo(left("sel_index   = ",40) || dump_info(self.sel_index))
	    nodeinfo(left("id_appl   = ",40) || dump_info(self.id_appl))
	    nodeinfo(left("id_forward_ref   = ",40) || dump_info(self.id_forward_ref))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class QStrNode : Node : ConsNode(signature,sig_done,sel_type,str_string,str_use_list,str_expansion,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # QStr
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("sel_type   = ",40) || dump_info(self.sel_type))
	    nodeinfo(left("str_string   = ",40) || dump_info(self.str_string))
	    nodeinfo(left("str_use_list   = ",40) || dump_info(self.str_use_list))
	    nodeinfo(left("str_expansion   = ",40) || dump_info(self.str_expansion))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class UQStrNode : Node : ConsNode(signature,sig_done,sel_type,str_string,str_use_list,str_expansion,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # UQStr
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("sel_type   = ",40) || dump_info(self.sel_type))
	    nodeinfo(left("str_string   = ",40) || dump_info(self.str_string))
	    nodeinfo(left("str_use_list   = ",40) || dump_info(self.str_use_list))
	    nodeinfo(left("str_expansion   = ",40) || dump_info(self.str_expansion))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class FConstruction : Node : ConsNode(signature,sig_done,ar_size,ar_static_link,ar_static_level,fc_body,fc_complexity,fc_code_label,fc_free_vars,fc_body_needed,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # FuncConstr
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("ar_size   = ",40) || dump_info(self.ar_size))
	    nodeinfo(left("ar_static_link   = ",40) || dump_info(self.ar_static_link))
	    nodeinfo(left("ar_static_level   = ",40) || dump_info(self.ar_static_level))
	    nodeinfo(left("fc_body   = ",40) || dump_info(self.fc_body))
	    nodeinfo(left("fc_complexity   = ",40) || dump_info(self.fc_complexity))
	    nodeinfo(left("fc_code_label   = ",40) || dump_info(self.fc_code_label))
	    nodeinfo(left("fc_free_vars   = ",40) || dump_info(self.fc_free_vars))
	    nodeinfo(left("fc_body_needed   = ",40) || dump_info(self.fc_body_needed))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class FreeVarNode : Node : ConsNode(fv_last_definition,fv_surr_class,fv_surr_index,fv_index,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # FreeVarNode
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("fv_last_definition   = ",40) || dump_info(self.fv_last_definition))
	    nodeinfo(left("fv_surr_   = ",40) || dump_info(self.fv_surr_))
	    nodeinfo(left("fv_surr_index   = ",40) || dump_info(self.fv_surr_index))
	    nodeinfo(left("fv_index   = ",40) || dump_info(self.fv_index))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class ExternDefNode : Node : ConsNode(ext_name,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # ExternDef
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("ext_name   = ",40) || dump_info(self.ext_name))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class RExternDef : Node : ConsNode(signature,sig_done,r_ext_name,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
{ # RExternDef
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("signature   = ",40) || dump_info(self.signature))
	    nodeinfo(left("sig_done   = ",40) || dump_info(self.sig_done))
	    nodeinfo(left("r_ext_name   = ",40) || dump_info(self.r_ext_name))
	}
end
initially
self$Node.initially (kind,vlineno,pre_num,post_num)
self$ConsNode.initially(cn_hd_field,cn_tl_field)


end
class DcsException : Node : ConsNode(dcse_char,dcse_inline,dcse_special,dcse_construction,kind,vlineno,pre_num,post_num,cn_hd_field,cn_tl_field,cn_hd_field,cn_tl_field)
method dump()
 { # DcsException
self$Node.dump()
self$ConsNode.dump()
	    nodeinfo(left("dcse_char   = ",40) || dump_info(self.dcse_char))
	    nodeinfo(left("dcse_inline   = ",40) || dump_info(self.dcse_inline))
	    nodeinfo(left("dcse_special   = ",40) || dump_info(self.dcse_special))
	    nodeinfo(left("dcse_construction   = ",40) || dump_info(self.dcse_construction))
	}
end
end
#######################################################################
procedure dump_info(it)
if type(it) == "integer" then return it
else if type(it) == "string"then return it
else if type(it) == "real" then return it
else return type(it)
end
