use new compile_top instead of compile_dec for compile_primitives