;;; Copyright (c) 1991--2022 ;;; John Carroll, Ann Copestake, Robert Malouf, Stephan Oepen, ;;; Benjamin Waldron; see `LICENSE' for conditions. (in-package :make) ;;; ;;; the :tty feature, when set, disables all graphics. the graphical user ;;; interface currently requires CLIM (tested using Allegro CL on Unix and on ;;; Windows) or Macintosh CL. Common Graphics (Allegro CL on Windoze) support ;;; was partly done but isn't in sync so the code to load this has been ;;; commented out ;;; ;;; push()ing :tty manually (before any load-system() call) can also be used ;;; to force non-graphics mode, if this seems desirable for some reason. ;;; ;;; ;;; ultimately, all compile-time configurations (by means of *features*) that ;;; affect more than just one file should go here (together with a comment on ;;; what each feature does); with features added in individual files, we still ;;; need to worry about load() order. ;;; ;;; - :psql -- support for (external) PostGreSQL-based lexical database; ;;; - :preprocessor -- include RE library and enable preprocessor support; ;;; - :s-xml -- include S-XML parser and enable simple preprocessing protocol; ;;; - :lsp -- Linguistic Server Protocol (also used for LUI communication); ;;; - :pooling -- enable recycling of high-frequency objects (dags, for now); ;;; - :vanilla -- run passive parser in pure CKY mode: disable `left-corner' ;;; optimization, rule filter, and quick check. ;;; (eval-when #+:ansi-eval-when (:load-toplevel :compile-toplevel :execute) #-:ansi-eval-when (load eval compile) (pushnew :lkb *features*) (pushnew :lkb-v5.6 *features*) #+(or :cl-http (not (or :mcl :clim))) (pushnew :tty *features*) ;; S-XML to be loaded in all CL implementations ;; (pushnew :s-xml *features*) ;; Allegro builds get pxml as well, used instead of S-XML in (R)MRS and SPPP - ;; explanation at http://lists.delph-in.net/archives/developers/2007/000872.html ;; #+(and :allegro (version>= 6 0)) (pushnew :pxml *features*) ;; ;; enable `pooling' (aka LKB-internal explicit memory management) for heavily ;; used object types (primarily dags during unification). ;; #-(and :sbcl :64-bit) (pushnew :pooling *features*) ;; ;; always include finite-state preprocessing support ;; (pushnew :preprocessor *features*) ;; ;; activate the LUI support code for select environments ;; #+(or (and :allegro (or :linux86 :linux86-64 :powerpc)) (and :ccl :unix) ; not on Windows (and :sbcl :unix)) (pushnew :lui *features*) ;; ;; YY input format only on unix; also relies on some [incr tsdb()] code ;; #+:unix (pushnew :yy *features*) ;; ;; activate PSQL (used in the lexical database) support when running ;; on supported platforms / architectures ;; #+(or :allegro (and :sbcl :unix)) (pushnew :psql *features*) ;; ;; as of may-04, we assume the LKB _always_ includes the MRS and MT code. ;; (pushnew :mrs *features*) (pushnew :mt *features*)) ;;; ;;; next, test some common feature dependencies; add additional features where ;;; appropriate. note the separate eval-when(), as feature presence is tested ;;; at read time: to see the effects of everything up to this point, a separate ;;; s-expression is needed here. ;;; (eval-when #+:ansi-eval-when (:load-toplevel :compile-toplevel :execute) #-:ansi-eval-when (load eval compile) #+(or :lui (and :allegro (version>= 6 0))) (pushnew :lsp *features*)) (defparameter *lisp-specific-directory* (or #+:clim "CLIM_specific" #+(and :allegro (not :clim) :tty) "CLIM_specific" #+(and :null :allegro :common-graphics (not (or :clim :tty))) "ACL-CG_specific" #+:mcl "MCL_specific" "")) (defsystem "lkb" :source-pathname (get-sources-dir "lkb") :binary-pathname (get-binaries-dir "lkb") :source-extension "lsp" :depends-on (#+:pxml "pxml" #+:psql "psql" #+:preprocessor "preprocessor") :initially-do (progn ;; ;; we're being conservative about needing quickload: user may already have loaded ;; the necessary subsystems (via ASDF or similar), in which case we just pass ;; (mapc #'(lambda (s) (unless (find-package s) (funcall (intern "QUICKLOAD" :ql) s))) '(:s-xml :cl-fad :cl-ppcre :cl-ppcre-unicode)) ;; ;; limit cl-ppcre's char code limit parameter to a maximum of 2^16 (corresponding to ;; the Unicode Basic Multilingual Plane), otherwise scanners can end up massive ;; (setf (symbol-value (find-symbol "*REGEX-CHAR-CODE-LIMIT*" :cl-ppcre)) (min char-code-limit (expt 2 16)))) :finally-do (let ((mrs-loaded (find-symbol "*MRS-LOADED*" :lkb)) (building-image-p (find-symbol "*BUILDING-IMAGE-P*" :make))) (when mrs-loaded (setf (symbol-value mrs-loaded) t)) ;; ;; unless we are about to create a run-time image or operate in ;; [incr tsdb()] slave mode, initialize the LKB and start its GUI ;; (unless (or (and building-image-p (boundp building-image-p) (symbol-value building-image-p)) (find :slave *features*)) (funcall (symbol-function (find-symbol "START-LKB" :lkb)) nil))) :components ((:module "package" :source-pathname "" :binary-pathname "" :load-only t :components ((:file "lkb-package") (:file "mrs-package") (:file "mt-package" :load-only t))) (:module "version" :source-pathname "" :binary-pathname "" :components ((:file "version"))) (:module "initialization" :source-pathname "main" :binary-pathname "main" :components ((:file "initializations" :load-only t) (:file "globals") ; variables for grammar parameterization, mostly ; user-settable, usually in globals file associated ; with a grammar and loaded by its script file (:file "statistics") ;; (:file "ssp") ; JAC 15-May-2020 - disable )) #-:tty (:module "general graphics utilities" :source-pathname *lisp-specific-directory* :binary-pathname *lisp-specific-directory* :components ((:file "graphics") ; basic font handling etc (:file "misc") ; non-graphics Lisp specific (:file "topmenu") ; main interaction window/menu #+:clim (:file "selectfile") ; CLIM-only select-file - must load before dialog (:file "dialog"))) ; querying user (:module "main functionality" :source-pathname "main" :binary-pathname "main" :components ((:file "types") ; type hierarchy and associated functions (:file "dag") ; feature structures and unification (:file "yadu") ; default unification (:file "gen") ; generalisation (:file "structs") ; structures for path values etc (:file "marks") ; utility macros for type checking (:file "checktypes") ; type hierarchy and constraint ; construction and checking (:file "cdb") ; constant database, for storing lexicon (:file "leaf") ; leaf types - for efficiency not ; expanded at load time (:file "lex") ; lexical structures, also templates etc #+:plob (:file "plex") ; lexical database #+:ltemplates (:file "ltemplates") ; lexical templates (e.g. for cardinals) (:file "clex") ; constant lexical database (:file "rules") ; lexical, grammar and chart mapping rules (:file "parse") ; parser control, token chart, morphology etc (:file "chartmap") ; chart mapping (:file "active") ; key-driven (hyper-)active parser (:file "parsebatch") ; batch parsing (:file "unpack") ; exhaustive and selective unpacking (:file "brackets") ; partial bracketing constraints (:file "morph") ; morphographemics (:file "check-unif") ; the unification quick check (:file "discriminants") (:file "unfill-dag") ; unfilled feature structures (:file "generics") (:file "compound-lex") ; lexicon-wrapper for compounds (:file "user-fns"))) ; as globals - but functions #+:preprocessor (:module "preprocess" :source-pathname "preprocess" :binary-pathname "preprocess" :components ((:file "preprocess") (:file "graph") (:file "external-smaf") #+(or :allegro :acl-compat) (:file "server") #+:mrs (:file "hook-mrs"))) (:module "lexdb" :source-pathname "lexdb" :binary-pathname "lexdb" :components ((:file "headers") (:file "lex-database") (:file "lex-entry") (:file "psql-msc") ; misc lexdb functions (:file "extract") ; extract fields for export (:file "gentdl") ; extract tdl for export #+:psql (:file "psqllex") #+:psql (:file "psql-database") #+:psql (:file "external-lex-database") #+:psql (:file "psql-lex-database0") #+:psql (:file "psql-lex-database") #+:psql (:file "psql-lex-database2") #+:psql (:file "psql-lex-entry") #+:psql (:file "command") #+:psql (:file "psql-emacs") ; Postgres-Emacs interface #+:psql (:file "lexport"))) ; export lexicon in various formats (:module "various io" :source-pathname "io-general" :binary-pathname "io-general" :components (#-tty (:file "menus") ; top level menus for varying set-ups (:file "async") ; utilities for doing asynchronous I/O (:file "outputfs") ; feature structure display (:file "outputtdfs") ; default fs display (:file "outputsrc") ; outputting machine readable versions ; (translating between formalisms) #-:tty (:file "toplevel"))) ; top level menu commands (:module "communication to external processes (LUI, LSP, et al.)" :source-pathname "glue" :binary-pathname "glue" :components (#+:lui (:file "dag" ) ; instrumented unifier for LUI use #+:lsp (:file "lsp") ; socket-based LKB server mode #+:lui (:file "lui") ; Linguistic User Interface #+(and :lsp :allegro) (:file "rpc" ) ; XML-RPC server #+:preprocessor (:file "repp") ; regular-expression pre-processor #+:yy (:file "yy") ; interface to YY input format #+:s-xml (:file "sppp"))) ; Simple PreProcessor Protocol (deprecated) (:module "path notation input" ; original LKB notation :source-pathname "io-paths" ; toplevel fns also used :binary-pathname "io-paths" ; by TDL files (below) :components ((:file "typeinput") ; types and main input fns used by ; other input files (:file "lexinput") ; lexical entries, templates etc (:file "ruleinput") ; lexical and grammar rules (:file "pathout"))) ; output in path notation (:module "TDL syntax input" :source-pathname "io-tdl" :binary-pathname "io-tdl" :components ((:file "tdltypeinput") (:file "tdloutput") ; output in TDL notation (:file "tdlruleinput") (:file "tdllexinput"))) (:module "LiLFeS syntax output" :source-pathname "io-lilfes" :binary-pathname "io-lilfes" :components ((:file "lilout"))) ; output in LiLFeS notation #-:tty (:module "Lisp specific graphics" :source-pathname *lisp-specific-directory* :binary-pathname *lisp-specific-directory* :components (#+:clim (:file "graph") ; CLIM-only graph drawing #+:mcl (:file "picwin") ; MCL-only low level stuff #+:mcl (:file "picfield") ; for display ;; #+(and :allegro (not :clim) :common-graphics) ;; (:file "fsclasses") (:file "activefs") ; feature structure (:file "tree") ; type hierarchy #+:mcclim (:file "tooltips") ; tooltips for FS and type hierarchy (:file "parseout") ; parse/generate tree (:file "chartout") ; parse/generate chart (:file "listout") ; `active' lists #+(or :clim :www) (:file "compare"))) ; comparing parses #+(or :allegro :mcclim) (:module "emacs-interface" :source-pathname *lisp-specific-directory* :binary-pathname *lisp-specific-directory* :components ((:file "emacs"))) ; recording source positions (:module "non-Lisp specific graphics" :source-pathname "io-general" :binary-pathname "io-general" :components ((:file "tree-nodes") ; non-Lisp specific code used ; in parse/generate chart and ; tree drawing code (:file "utils") #+(and (not :clim) (not :tty)) (:file "graph"))) ; JAC's graph package (:module "user utility functions" :source-pathname "main" :binary-pathname "main" :components ((:file "batch-check") ; batch check lexicon (:file "debug"))) ; rudimentary debugging ; for errors in type file #+:tty (:module "tty commands" ; redefine for tty version :source-pathname "tty" :binary-pathname "tty" :components ((:file "tty"))) #+:arboretum (:module "Arboretum" ; CALL grammar checking functions :source-pathname "graft" :binary-pathname "graft" :components ((:file "arboretum"))) (:module "tdl generation" ; ERB 2004-08-25 :source-pathname "non-core" ; utilities for generating :binary-pathname "non-core" ; head types in the Matrix :components ((:file "powerset.lsp"))) ;; ;; from here on, inclusion of MRS code; some of this is maintained as a ;; stand-alone `mrs.system' too, hence maintaining both system definitions ;; may be required; there is, unfortunately, no way of adding a post-load ;; dependency to a system :-{. (7-jun-04; oe) ;; (:module "mrs" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "lkb-interface") ; interface functions to LKB (:file "mrsglobals") ; some defaults for grammar-specific ; variables, typically adapted in a ; grammar-specific file. (:file "basemrs") ; MRS structures and printing (:file "mrsoutput") ; constructing MRS from parse result (:file "mrscorpus") ; checking equality etc (:file "algebra") ; semantic algebra for composition (:file "interface") (:file "lnk"))) (:module "scoping" ; module can be excluded for generation :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "mrsresolve") ; resolving scope (:file "mrscons"))) ; constraints on scope (:module "munge" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "cheapscope") ; scope for fragments (:file "mrsmunge") ; manipulate MRS via rules ; currently for vitrifying - potential ; other uses (:file "mrsruleinput") ; creating rules for above ; requires LKB, but outputs compiled ; rules which can be used without LKB #+(and :clim (not :tty)) (:file "lkb-acl-mrs") ; display etc in CLIM #+(and :mcl (not :tty)) (:file "lkb-mcl-mrs"))) ; display etc in MCL (:module "generator-morph" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "lexutils") (:file "lexindex") ; LKB specific - indexing ; entries etc on semantics (:file "lexlookup") ; LKB specific - retrieving (:file "genpredict") ; LKB specific - null semantics (:file "serialize"))) ; simple generator index cache (:module "generator" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "generate") ; chart generator (requires mrs) (:file "spell") ; for a/an (:file "genbatch") (:file "mrstoplevel"))) (:module "idioms" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "idioms"))) #+:nil (:module "information-structure" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "infostr"))) (:module "theorem-proving" :source-pathname "tproving" :binary-pathname "tproving" :source-extension "lisp" :components ((:file "gq") (:file "gq-to-fol") (:file "fol-to-nf") ;; (:file "dtp-interface") (:file "nf-to-fol") (:file "fol-to-mrs"))) (:module "rmrs" :source-pathname "rmrs" :binary-pathname "rmrs" :source-extension "lisp" :components ((:file "basermrs") ; the RMRS specific structures (:file "comp") ; main code for semantic composition (:file "rmrs-algebra") ; new code for ING free composition (:file "rmrs-convert") ; MRS to RMRS (:file "annlt") ; The ANNLT specific code - navigates round the input trees (:file "output") ; outputting RMRS structures, and also LKB ; generated structures in a compatible format. ; In principle, supports multiple outputs - right no ; outputs stuff in XML or a compact representation ; LKB-specific code for comparison windows ; but #+:lkb used #+:s-xml (:file "xml-utils") ; some utilities for XML parser (:file "readgram") ; loads the data file that associates the ; rule names with semantic operations (:file "readtag") ; loads the data file that associates the tags with ; base semantic structures - uses a lot of code from ; readgram (:file "input") ; loads the underlying rmrs input code (:file "compare") ; RMRS comparison #+(and :clim (not :tty)) (:file "lkb-acl-rmrs") ; display etc in CLIM (:file "testing") ; temporary file for testing (:file "dmrs") ; dependency MRS (:file "simplify") ; simplification of DMRS (:file "dmrsoutput") ; DMRS direct from a grammar - experimental ;; (:file "anaphora") ; very simple anaphora code )) (:module "redwoods" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "dependencies") (:file "edm"))) #+:lsp (:module "lsp" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "lsp"))) #+:multiprocessing (:module "translation" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "translate"))) ; collection of crude MT functions (:module "semi" ; the semantic interface :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lsp" :source-extension "lisp" :components ((:file "semi") #+:psql (:file "semi-psql"))) #+:nil (:module "extensions" :source-pathname "mrs" :binary-pathname "mrs" :source-extension "lisp" :components ((:file "time-convert"))) ; may be useful to have a version of ; this for non-VM apps ; currently VM specific ;; ;; the add-on MT facilities; assuming both the LKB and MRS ;; code are available (the original `mt.system'). ;; (:module "mt" :source-pathname "mt" :binary-pathname "mt" :source-extension "lisp" :components ((:file "version" :load-only t) #+:logon (:file "mrsglobals" :load-only t) (:file "globals") (:file "patches") (:file "mrs") (:file "vpm") (:file "semi") (:file "transfer") (:file "comparison") (:file "aac") #+:multiprocessing (:file "translate") #+:clim (:file "clim") (:file "fragments") #+:multiprocessing (:file "utool")))))