1/*******************************************************************
    2 *
    3 * A Common Lisp compiler/interpretor, written in Prolog
    4 *
    5 * Douglas'' Notes:
    6 *
    7 * (c) Douglas Miles, 2017
    8 *
    9 * The program is a *HUGE* common-lisp compiler/interpreter. It is written for YAP/SWI-Prolog (YAP 4x faster).
   10 *
   11 * This codebase contains ideas from the examinations of  
   12 *   Neil Smith, Tim Finin, Markus Triska and the Straightforward Implementation of Scheme
   13 * 
   14 * Changes since 2001:
   15 *
   16 *
   17 *******************************************************************/
   18
   19
   20:- set_prolog_flag(generate_debug_info, true).   21
   22% :- require([colormsg1/1]).
   23
   24:- system:use_module(library(apply),[exclude/3]).   25:- system:use_module(library(apply),[maplist/2,maplist/3]).   26:- system:use_module(library(error),[existence_error/2]).   27:- system:use_module(library(gensym),[gensym/2]).   28:- system:use_module(library(lists),[member/2,append/3,nth1/3,select/3]).   29:- system:use_module(library(occurs),[sub_term/2,contains_var/2]).   30:- system:use_module(library(backcomp)).   31:- system:use_module(library(rbtrees)).   32:- system:use_module(library(lists),[member/2,append/3,nth1/3,select/3]).   33
   34:- multifile(user:portray/1).   35:- dynamic(user:portray/1).   36:- discontiguous(user:portray/1).   37
   38
   39:- if(current_prolog_flag(debug,false)).   40
   41%:- set_prolog_flag(last_call_optimisation,true).
   42:- set_prolog_flag(compile_meta_arguments,false).   43%:- set_prolog_flag(access_level,system).
   44
   45:- endif.   46
   47:- if(\+ current_module(sxpr)).   48:- if(\+ current_module(sxpr_reader)).   49:- ensure_loaded(sreader).   50:- endif.   51:- endif.   52
   53%:- use_module(library(logicmoo/portray_vars)).
   54
   55:- multifile(wl:symbol_has_prop_set_get/4).   56:- multifile(wl:symbol_has_prop_getter/3).   57:- multifile(wl:symbol_has_prop_setter/3).   58:- dynamic(wl:symbol_has_prop_get_set/4).   59:- dynamic(wl:symbol_has_prop_getter/3).   60:- dynamic(wl:symbol_has_prop_setter/3).   61:- discontiguous(wl:symbol_has_prop_get_set/4).   62:- discontiguous(wl:symbol_has_prop_getter/3).   63:- discontiguous(wl:symbol_has_prop_setter/3).   64
   65:- dynamic(tst:is_local_test/1).   66:- multifile(tst:is_local_test/1).   67:- discontiguous(tst:is_local_test/1).   68:- dynamic(tst:is_local_test/2).   69:- multifile(tst:is_local_test/2).   70:- discontiguous(tst:is_local_test/2).   71
   72
   73:- dynamic(tst:is_local_test/3).   74:- multifile(tst:is_local_test/3).   75:- discontiguous(tst:is_local_test/3).   76
   77:- dynamic(shared_lisp_compiler:plugin_expand_function_body/5).   78:- multifile(shared_lisp_compiler:plugin_expand_function_body/5).   79:- discontiguous(shared_lisp_compiler:plugin_expand_function_body/5).   80
   81:- multifile(wl:op_replacement/2).   82:- dynamic(wl:op_replacement/2).   83:- discontiguous(wl:op_replacement/2).   84
   85:- multifile(wl:setf_inverse/2).   86:- dynamic(wl:setf_inverse/2).   87:- discontiguous(wl:setf_inverse/2).   88
   89:- multifile(wl:declared_as/2).   90:- dynamic(wl:declared_as/2).   91:- discontiguous(wl:declared_as/2).   92
   93:- multifile(wl:error_hook/2).   94:- dynamic(wl:error_hook/2).   95:- discontiguous(wl:error_hook/2).   96
   97:- multifile(wl:init_args/2).   98:- dynamic(wl:init_args/2).   99:- discontiguous(wl:init_args/2).  100
  101:- multifile(wl:uses_rest_only/1).  102:- dynamic(wl:uses_rest_only/1).  103:- discontiguous(wl:uses_rest_only/1).  104
  105:- multifile(wl:interned_eval/1).  106:- dynamic(wl:interned_eval/1).  107:- discontiguous(wl:interned_eval/1).  108
  109:- multifile(wl:plugin_expand_progbody/6).  110:- dynamic(wl:plugin_expand_progbody/6).  111:- discontiguous(wl:plugin_expand_progbody/6).  112
  113:- multifile(wl:plugin_expand_progbody_1st/6).  114:- dynamic(wl:plugin_expand_progbody/6).  115:- discontiguous(wl:plugin_expand_progbody_1st/6).  116
  117% Ran at load
  118:- multifile(wl:interned_eval/1).  119:- dynamic(wl:interned_eval/1).  120:- discontiguous(wl:interned_eval/1).  121
  122% Ran at for rebuilding
  123:- multifile(wl:interned_eval_devel/1).  124:- dynamic(wl:interned_eval_devel/1).  125:- discontiguous(wl:interned_eval_devel/1).  126
  127:- multifile(wl:type_checked/1).  128:- dynamic(wl:type_checked/1).  129:- discontiguous(wl:type_checked/1).  130
  131:- dynamic(wl:pass_clause/3).  132:- multifile(wl:pass_clause/3).  133:- discontiguous(wl:pass_clause/3).  134
  135:- dynamic(wl:grovel_pred/3).  136:- multifile(wl:grovel_pred/3).  137:- discontiguous(wl:grovel_pred/3).  138
  139
  140:- multifile(wl:coercion/3).  141:- dynamic(wl:coercion/3).  142:- discontiguous(wl:coercion/3).  143
  144:- discontiguous(wl:lambda_def/5).  145:- dynamic(wl:lambda_def/5).  146:- multifile(wl:lambda_def/5).  147:- export(wl:lambda_def/5).  148:- system:import(wl:lambda_def/5).  149
  150:- discontiguous(wl:arglist_info/5).  151:- dynamic(wl:arglist_info/5).  152:- multifile(wl:arglist_info/5).  153:- export(wl:arglist_info/5).  154:- system:import(wl:arglist_info/5).  155
  156:- discontiguous(wl:arglist_info/4).  157:- dynamic(wl:arglist_info/4).  158:- multifile(wl:arglist_info/4).  159:- export(wl:arglist_info/4).  160:- system:import(wl:arglist_info/4).  161
  162%:- dynamic(compile_assigns/4).
  163%:- multifile(compile_assigns/4).
  164%:- discontiguous(compile_assigns/4).
  165
  166%:- dynamic(ssip_define/2).
  167:- multifile(ssip_define/2).  168:- discontiguous(ssip_define/2).  169
  170:- use_module(library(logicmoo_common)).  171:- user:ensure_loaded(library(logicmoo/portray_vars)).  172:- ensure_loaded(eightball).  173:- ensure_loaded('init').  174:- ensure_loaded(utests).  175:- ensure_loaded(places).  176:- ensure_loaded(environs).  177:- ensure_loaded(proclaim).  178:- ensure_loaded(packages).  179:- ensure_loaded(soops).  180:- ensure_loaded(defmacro).  181:- ensure_loaded(strings).  182:- ensure_loaded(symbols).  183:- ensure_loaded(lexvars).  184:- ensure_loaded(condifs).  185:- ensure_loaded(readers).  186
  187:- ensure_loaded(primitives).  188:- ensure_loaded(conses).  189
  190
  191:- ensure_loaded(arglists).  192:- ensure_loaded(arrays).  193:- ensure_loaded(backquote).  194:- ensure_loaded(body).  195:- ensure_loaded(prologfns).  196:- ensure_loaded(compile).  197:- ensure_loaded(conditions).  198:- ensure_loaded(closures).  199:- ensure_loaded(describe).  200:- ensure_loaded(disassemble).  201:- ensure_loaded(fileload).  202:- ensure_loaded(threading).  203:- ensure_loaded(funcall).  204:- ensure_loaded(clstructs).  205
  206:- ensure_loaded(defun).  207:- ensure_loaded(defgeneric).  208:- ensure_loaded(hashtables).  209:- ensure_loaded(interp).  210:- ensure_loaded(mizepro).  211:- ensure_loaded(namestrings).  212:- ensure_loaded(numbers).  213:- ensure_loaded(operatorfns).  214:- ensure_loaded(pathnames).  215:- ensure_loaded(printers).  216:- ensure_loaded(readtables).  217:- ensure_loaded(repl).  218:- ensure_loaded(sequences).  219:- ensure_loaded(streams).  220:- ensure_loaded(block).  221:- ensure_loaded(tagbody).  222:- ensure_loaded(typecheck).  223:- ensure_loaded(typeof).  224:- ensure_loaded(loptions).  225:- ensure_loaded(groveler).  226:- ensure_loaded(paramfns).  227:- ensure_loaded(socksrv).  228
  229
  230/*
  231:- ensure_loaded(utils_for_swi).
  232:- ensure_loaded(utils_higher_order).
  233:- ensure_loaded(utils_list).
  234:- ensure_loaded(utils_oset).
  235:- ensure_loaded(utils_set).
  236:- ensure_loaded(utils_shortest_paths).
  237:- ensure_loaded(utils_writef).
  238%:- use_module(utils_list).
  239:- use_module(utils_higher_order).
  240*/
  241
  242:- grovel_system_symbols.