;;; Copyright (c) 1991--2004 ;;; 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; ;;; - :xml -- include 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.4 *features*) #+(or :cl-http (not (or :mcl :clim))) (pushnew :tty *features*) ;; S-XML should compile under any Common Lisp (pushnew :xml *features*) ;; Allegro users still get pxml for (R)MRS and SPPP functionality ;; (but if :pxml is not set, these both use S-XML) #+(and :allegro (version>= 6 0)) (pushnew :pxml *features*) ;; [bmw] basic multiprocessing support in sbcl #+:sbcl (pushnew :multiprocessing *features*) ;; ;; always allow `pooling' (aka LKB-internal explicit memory management) for ;; heavily used object types (primarily dags during unification). ;; (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 :openmcl :powerpc) (and :sbcl (or :x86 :x86-64) :linux)) (pushnew :lui *features*) ;; ;; activate PSQL (used in the lexical database) support when running ;; on supported platforms, i.e. Linux (x86), Solaris, and Windoze ;; #+(or :allegro (and :sbcl (or :x86 :x86-64) :linux)) (pushnew :psql *features*) ;; ;; on select platforms, the binaries and scripts for language model support ;; (used as a component in ranking generator outputs) are available in CVS. ;; _fix_me_ ;; compile and distribute evallm(1) for more platforms. (1-oct-05; oe) ;; #+(and :logon :multiprocessing (or :linux86 :linux86-64)) (pushnew :lm *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 #+(and :allegro :clim) "ACL_specific" #+(and :mcl :clim) "ACL_specific" #+(and :lispworks :clim) "ACL_specific" #+(and :allegro (not :clim) :tty) "ACL_specific" #+(and :null :allegro :common-graphics (not (or :clim :tty))) "ACL-CG_specific" #+(and :mcl (not :clim)) "MCL_specific" "")) (defsystem "lkb" :source-pathname (get-sources-dir "lkb") :binary-pathname (get-binaries-dir "lkb") :source-extension "lsp" :depends-on (#+:psql "psql" #+(and :preprocessor (not :sbcl)) "ppcre" #+:preprocessor "preprocessor" #+:xml "s-xml") :initially-do (require :pxml) :finally-do (let* ((package (find-package :lkb)) (symbol (find-symbol "*MRS-LOADED*" package))) (when symbol (set symbol t)) (funcall (symbol-function (find-symbol "START-LKB" :lkb)))) :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") (:file "statistics") (:file "ssp"))) ;; variables for grammar parameterization ;; mostly user-settable, usually reset by a globals file associated ;; with a particular grammar and loaded by the script file #-: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 (: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 "user-fns") ; as globals - but functions (: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") ; grammar and lexical rules (:file "parse") ; chart parser (:file "active") ; key-driven (hyper-)active parser (:file "unpack") ; exhaustive and selective unpacking (:file "brackets") ; partial bracketing constraints (:file "morph") ; morphographemics (:file "check-unif") ; for efficiency (:file "discriminants") (:file "unfill-dag") ; unfilled feature structures (:file "generics") (:file "compound-lex") ; lexicon-wrapper for compounds )) #+: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 #+: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" ; as used in ERG :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") ; uses CLIM graph drawing #+(and :mcl (not :clim)) (:file "picwin") ; low level #+(and :mcl (not :clim)) (:file "picfield") ; low level ; #+(and :allegro (not :clim) :common-graphics) ; (:file "fsclasses") ; classes for display (:file "activefs") ; display FS in window (:file "tree") ; type hierarchy (:file "parseout") ; parse tree output (:file "chartout") ; parse chart (:file "listout") ; `active' lists #+(or :clim :www) (:file "compare"))) ; comparing parses #+:allegro (: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 ; display functions used ; in parse/generate chart ; and tree drawing code (:file "utils") ; miscellany #+(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 do 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"))) ;; following two files needed for scoping - can be excluded ;; for generation (:module "scoping" :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 :clim) (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"))) ; 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 #+: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 ;; ;; and now for 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") #+:lm (:file "lm") #+:logon (:file "smt") #+:multiprocessing (:file "utool")))))