;****************************************************************************** ; "game : SHERLOCK!" ; "file : PARSER.ZIL" ; "auth : $Author: DEB $" ; "date : $Date: 27 Oct 1987 19:00:52 $" ; "rev : $Revision: 1.55 $" ; "vers : 1.00" ;****************************************************************************** > > ; "held" ; "carried" ; "in room" ; "on ground" ; "take" ; "many" ; "have" ; "the number of the last object" ; ; "room action context begin case" ; "room action context entering case" ; "room action routine entered case" ; "room action routine exit case" ; "room action routine end case" ; "for container routine general case" ; "for container routine limitations" ; "replaces DESCFCN property" ; "replaces SDESC" ; "byte offset to # of entries in LEXV" ; "word offset to start of LEXV entries" ; "number of words per LEXV entry" ; "offset to parts of speech byte" ; "offset to first parts of speech" ; "first part of speech mask in PSOFF byte" > >) (T > 32>> 1> <+ 1>>)>> .CNT> ; ) (T > >)>>> > ) (> >) (T > )>> > )> > 0>> > )> 0>> > )> )>> .THE?>> ) WRD (FIRST?? T) (PN <>)) ) (T >) (T )> > >> >> >>> )> ) ( ,PS?PREPOSITION>> ,PS?OBJECT>>> ) ( ) ( > ) (T > )> > ) ( > ) ( > ) ( > ) ( > ) (T >)> >)>)> >>> ) (T > )> >> 2> 3>> > > > >> 2> 3>> > > > ) (STRING? <>) (PRSO? T) "AUX" WRD) ) ( ) (T )> ) ( >> ) (T > >)> >> >> )> )> > )) > ) ( ) (T >)> <==? ,GL-WINNER ,CH-BUTLER>> <==? ,GL-WINNER ,CH-SHERMAN>>>>> > > )>) (T )>)>) (T > > )>) (T )>)>)> ) ( ) (T )> >> )> > > > ) (> >) (T > )> > > ) "AUX" TOD) > > > ) (T ; ) ( ) ( ) (T )>)> )>)>> )) 1> ) ( 1> ) ( 1> ) ( 1> ) (T ) > > ;------------------------------------------------------------------------------ ; "RT-SPOKEN-TO-MSG" ;------------------------------------------------------------------------------ > >> > )> > ;------------------------------------------------------------------------------ ; "RT-SYNTAX-CHECK" ; "Perform syntax matching operations, using GL-P-ITBL as the source of" ; "the verb and adjectives for this input. Returns false if no" ; "syntax matches, and does it's own orphaning. If return is true," ; "the syntax is saved in GL-P-SYNTAX" ;------------------------------------------------------------------------------ >) (T >)> >> 0) (T <+ .PREP *300*>)>> ) (DRIVE2 <>) PREP VERB TPREP) > )> >> > > ,K-P-SONUMS>> > T) ( >> >>> ) ( > > ) ( >> T) ( >> )>)> > ) ( ,GL-FUNNY-CLAUSE?> > > >) (T )>) (T >) (<1? .NUM> >) (T >)> ;>)>> ;>>> ) ( ;>>> ) ( ) (T ) (T )> ) ( ,FL-PERSON>> ,FL-PERSON>>> ) (T )> ) (T )> )> > ;) (T ;)>> ) (T > )> )>> ;------------------------------------------------------------------------------ ; "RT-CLAUSE" ; "scan through a noun phrase, leaving a pointer to its starting location" ;------------------------------------------------------------------------------ ) (FIRST?? T) NW (LW 0) TPTR TMP) 2>> > .VAL> .WRD> >) (T >)> > )> > >> ,W?THE ,W?A ,W?AN> 4>>)> > 0> >> )> >> ) (>> > ;>> ) (T >>>> > )>)>)> ; ,ACT?MAKE ,ACT?TAKE>> )> >> ) ( ) ( > >)>) ( >> > >> >) ( > >> > ,W?THEN> >) ( >> .WRD>) ( > > T) (<==? .NW ,W?TOMB> T) (T )>) (<==? .WRD ,W?TOMB> )> > 2>>> )>)> T) ( > >> 2>>> ) (T >)>) ( >> ,PS?BUZZ-WORD>>) ( >> > ,W?THEN> >) ( T) (T )>) (T )> > >>> ;------------------------------------------------------------------------------ ; "RT-GET-WHAT-I-MEAN" ;------------------------------------------------------------------------------ ) (SILENT? <>) "AUX" OBJ) ) ( > )> )> > 1> > > > > )> )> > )>) (T > )>> ;***************************************************************************** ; "routines with no screen output" ;***************************************************************************** ;----------------------------------------------------------------------------- ; "RT-P-CLEAR" ;----------------------------------------------------------------------------- > > > ;------------------------------------------------------------------------------ ; "RT-PICK-NEXT" ;------------------------------------------------------------------------------ > 0>> > > > )> > > ) (T )>> ) (WHO-A <>)) > ) ( >> ) ;"RFP" ( ) (T )>)>) ( >> > ) ;"RFP" ( ) (T )>)> )> >> ) ( ) ;( ;"RFP" )> > ) (T >)>> > )> > > > ) ( > ) ( ) (T )>> ) (> >> )> > ,ROOMS ,GLOBAL-OBJECTS> ) ( ) ( > ) (T )>> ,CH-PLAYER ,TH-NOT-HERE-OBJECT> > ) ( > ) ( > ) ( > ) ( ) ( ) (T > >) (T )> )>> ) "AUX" X Y Z) >>> > >> >> >> )> > ;------------------------------------------------------------------------------ ; "RT-WT?" ; "Check whether word pointed at by PTR is the correct part of speech." ; "The second argument is the part of speech (,PS?). The" ; "3rd argument (,P1?), if given, causes the value" ; "for that part of speech to be returned." ;------------------------------------------------------------------------------ ; "This is only called through the WT? macro, when it doesn't generate a BTST directly..." > .BIT> ) (<==? .BIT ,PS?PREPOSITION> ; "We have to get the preposition ID out of PREPOSITIONS rather than the word" *203*>> )>) (T > ; "Following no longer applies, since there's only one byte defined for all this" ;> >)> )>)>> ;------------------------------------------------------------------------------ ; "RT-VERB-DIR-ONLY?" ;------------------------------------------------------------------------------ ,PS?ADJECTIVE> ,PS?VERB>>>> ) (T ) > > ;------------------------------------------------------------------------------ ; "RT-STUFF" ; "for AGAIN purposes, put contents of one LEXV table into another" ;------------------------------------------------------------------------------ >>> ;------------------------------------------------------------------------------ ; "RT-INBUF-ADD" ; "put the word in the positions specified from GL-P-PIBUF to the end of" ; "GL-OOPS-INBUF, leaving the appropriate pointers in GL-P-S-LEX" ;------------------------------------------------------------------------------ > ) (T >> >>> ) > > .LEN> ; >> )>> .LEN> > ;------------------------------------------------------------------------------ ; "RT-ACLAUSE-WIN" ;------------------------------------------------------------------------------ > > > > > > ;------------------------------------------------------------------------------ ; "RT-NCLAUSE-WIN" ;------------------------------------------------------------------------------ > > > > > ;----------------------------------------------------------------------------- ; "RT-ORPHAN-VERB" ;----------------------------------------------------------------------------- > ;------------------------------------------------------------------------------ ; "RT-ORPHAN" ;------------------------------------------------------------------------------ )> > > > >> ; ) (T >)>> )> > )> > ) ( > )>> ;------------------------------------------------------------------------------ ; "RT-ORPHAN-MERGE" ;------------------------------------------------------------------------------ ) WRD) > >> >>> T) ( 0>> ,PS?VERB ,P1?VERB> > > ) ( 0>> ,PS?ADJECTIVE> ) ( >> ; "ADDED 8/24/87 PER SWG"> > > )> >> >>> ) ( > > >)> ) ( 1> > > > > > >)> )>) (T > ;>)> >) (T )>) ( 1> > > > > > >)>)> > > ) (T )>) ( > > > ) (T > > >)> > > ) (T > )>) ( ,PS?ADJECTIVE> > >> ) ;( ) ( ,PS?OBJECT> ) (T )> )> > > )>>)>)> > > > ; 0>> > >> > ;----------------------------------------------------------------------------- ; "RT-ADJ-CHECK Per SWG 8/27/87" ;----------------------------------------------------------------------------- ) ( ) > > ;------------------------------------------------------------------------------ ; "RT-CLAUSE-COPY" ;------------------------------------------------------------------------------ ) "AUX" BEG END) > > ,K-P-LEXELEN> 2>>> ,K-P-LEXELEN>>>> ) (T > > ) > > ) > > > > ;------------------------------------------------------------------------------ ; "RT-CLAUSE-ADD" ;------------------------------------------------------------------------------ 2>> .WRD> > *003*>> 0>)> ; 2>> ; ) ( .PREP> >>)>>> ;------------------------------------------------------------------------------ ; "RT-SYNTAX-FOUND" ;------------------------------------------------------------------------------ >> ;------------------------------------------------------------------------------ ; "RT-BUT-MERGE" ;------------------------------------------------------------------------------ > ) > > > ; > ,GL-P-BUTS> T ) (T .OBJ> > ) > > > .NTBL > ;------------------------------------------------------------------------------ ; "RT-SNARF-OBJECTS" ;------------------------------------------------------------------------------ )) >>> > ,GL-P-PRSO> > > >>)> >>> > ,GL-P-PRSI> > > 1> >) (T >)>)>)> > ) LEN WV WRD NW (WAS-ALL? <>) ONEOBJ) > )> > >> )> ) (T > ) (T >)> >)>) ( > > ) ;( ) ( >)>) (T > > >)>) ( >> > > T) () () ( )>) ( >> ) ( )>)> > > )>>> ) "AUX" BTS LEN XBITS TLEN (GCHECK <>) (OLEN 0) OBJ ADJ X) > )> > >) (> > )>)> > > )> )> > > )> >) (T >)> ) (T )> )> .TLEN>> ) ( > > >> "?]" CR>)> ) ( >>> .LEN>> ) (T )> >> .TBL .LEN>>> )> > > ) ( >> ) ( > ,K-P-NC1) (T ,K-P-NC2)>> <>> ) ( )> > > )>) ( > > > > ) (T )>)> > > ) ( )> >> > )> > > >> ;------------------------------------------------------------------------------ ; "RT-MOBY-FIND" ; "This RT-MOBY-FIND works in both ZIL and ZIP" ;------------------------------------------------------------------------------ ) (COBJ-GOOD? <>) (CT 0)) > >>> > > >> > ; "We don't like what we've already found, so kill it" ) (<0? .CT> ;"First thing found, so OK" )> ) (<0? .CT> >)>) ( <0? > > >)>)> )>> >> >>>> ; "See if it's one of the things that can only be asked about" > ) (T > >)> )> )>)> > 1> ) (T >)>)> > ) RMGL) )> > > > > > >>>> )> > > 1> )>>> ;------------------------------------------------------------------------------ ; "RT-GLOBAL-CHECK" ;------------------------------------------------------------------------------ > )> > ; "These are now byte tables" > ; "To work correctly with the IGRTR? below" > > >> ; "We don't want to accidentally search some non-local room here..." )> )> )>>)> > >> > )> .LEN> > > )>)>)>> ;------------------------------------------------------------------------------ ; "RT-DO-SL" ;------------------------------------------------------------------------------ > ) (T ) ( ) (T ) > ) > > ;------------------------------------------------------------------------------ ; "RT-SEARCH-LIST" ;------------------------------------------------------------------------------ > > > )> > > > > ,K-P-SRCALL) ( >> ,K-P-SRCALL) (T ,K-P-SRCTOP)>>)> > )>>)>> ;------------------------------------------------------------------------------ ; "RT-THIS-IT?" ;------------------------------------------------------------------------------ ) SYNSIZE (ADJS <>) ADJSIZE) >> 2>>>>>> ) ( >> 2>>>>>> )> > ) ( > )> > )> )> >> )> > ;------------------------------------------------------------------------------ ; "RT-OBJ-FOUND" ;------------------------------------------------------------------------------ 1>> ) ( > )>)>)> > >> )> > )> ) ( > )> ) (> > )> ) ( )> ) (T )>> ) "AUX" (PTR 1) LEN OBJ L GOT (TRIED-TAKE? <>) (NEED-TAKE? <>)) > ) (>>> > > )> ; "Restore these settings if needed" > >)> ) ( > )> ) ( > )> ) ( > )> )> > > >> > > ; "Wants held, not carried" > )>) (> >> >>> > T) (T )>)> > > >) ( >> >) (> >) ( > ) ( > ) ( ) (T )> )> >) (T >)> ;> > > ,GLOBAL-OBJECTS ,LOCAL-GLOBALS>> ) (T > ) ( ) (T ) (T )>)>)> )> )>)>)> )>>)> > ) TMP) 1> ,SMANY>>> ) ( 1> ,SMANY>>> )> > ) ( > >) (T >)> ) (T )>> ) (RMFLG T) "AUX" OHERE (LIT <>)) )> > ) ( > )> > )>)> > > > )>)> 0> )> > > ) (I <>) "AUX" W-ROOM W-LOC I-LOC O-LOC V OA OO OI ONP WHO) >> )> > )> > > ; "beg - verb is a 'see' processing" )> ;"save globals for potential recursive call of rt-perform" > ; "set up some locals need below" > > ) (T )>) ( > ) (T ) ( )> )>) ( > ) (T )>)> ) (T )>) (T )> )> )>)> >> ) (T )> )> )> )>) (T ) (T )> )>)> > )> )> )>) (T ) (T )> )>)> > )> )> )>) (T ) (T )> )>)> )> )>)> ; "FCW - temp fix for TAKE OBJECT syntax to supply implied FROM object" >> >)> > > > >)>)> >)> > > >) (T )> ,K-M-WINNER>>)> ,K-M-BEG>>)> >>)> >> ,K-M-CANT>>)> > >> > >> ,K-M-CONT>>)> > >> > ,K-M-CONT>>)> >>)>)> ; "if v is 0 & verb is not walk & there is an o-object call o-object action routine" >> > >>)> ; "if v is 0 call verb routine" >>)> ; "if v is 0 call the location action routine with the end context" ,K-M-END>>)> ; "restore globals from locals saved for potential recursive call" > > >)> > > >)> ; "return value of first routine above which returned other than zero" > ,FL-VEHICLE> >> ) (T > ) > > ;------------------------------------------------------------------------------ ; "RT-PARSER" ; "Grovel down the input finding the verb, prepositions, and noun clauses." ; "If the input is or , fall out immediately" ; "setting PRSA to ,V?WALK and PRSO to . Otherwise, perform" ; "all required orphaning, syntax checking, and noun clause lookup." ;------------------------------------------------------------------------------ ) (OF-FLAG <>) (LEN 0) (DIR <>) (NW 0) (LW 0) (CNT 0) OWINNER OMERGED (TMP1 0)) > >>)> >> > > > > > > > > > > >)> > > >> >)> > )> > >) ( > > )>) (T > > 4> -5>> )> )> )> "> )> > ,W?QUOTE ,W?PERIOD ,W?THEN ,W?PLEASE ,W?SO> > >)> > ; "if first word is GO followed by a verb, ignore it" ,W?GO> >> > > >)> )> ,W?UNDO> ) (T > > )>> )>)> ,W?OOPS W?O> > ,W?PERIOD ,W?COMMA> > >)> > ) ( )> >> 6>> 7>> <+ <* ,K-P-LEXELEN> 3>> > > ) (T > )>) (T >)> ,W?AGAIN ,W?G> >> ) ( > ,W?PERIOD ,W?COMMA ,W?THEN> > ,W?AND>> >> 2>>) (T )>) (T > 1>>)> 0> ) (T >)> ; "Following cond per discussion with SWG." ) (T )> >>) (T ; "This COND created around the SETG per SWG to prevent the number value from disappearing when the parser orphans something. I.e. Which # do you mean?" )> > >>>> > >>> > > > 0> > ) (>> >> ) (T >>)> > ) ( > > ; "PER SWG 8/28/87") ( >> > )> >) (T )>)> >> ) (> ,ACT?WALK ,ACT?GO> > > > >>> ,W?THEN>)> > > )>) (> > 2>>>> >>) (> ,PS?OBJECT>> > > >> ) ( >> )>) ( ) (T > > > > )>)>) ( > ) (T >)>) ( <==? .WRD ,W?MARX>>) ( > ) (T )>) (T )> >>)> > > )> > > > )> > > T> >) (T )>)>) (T )>)>> ;------------------------------------------------------------------------------ ; "RT-WHICH-PRINT" ;------------------------------------------------------------------------------ > ) ( > ) (T > ) > > > > ) > ) ( ) > > 1> ) > > > ;------------------------------------------------------------------------------ ; "RT-FIND-NOT-HERE" ;------------------------------------------------------------------------------ > ) ( ) (T ) > ) ( > ,P?GENERIC> .TBL>> > ) ( ) (T ) > ) ( ) ( ) (T ,TH-NOT-HERE-OBJECT ) > > ;------------------------------------------------------------------------------ ; "RT-NOT-HERE-PRINT" ;------------------------------------------------------------------------------ )) > )> )>) ( <>>) (T <>>)>>