"REDS file: imitates old parser. Copyright (C) 1988 Infocom, Inc. All rights reserved."
) (T .NUM)>> "Generic reduction, which just returns a list of frobs" > ) (T )>)> T) (<==? .N 1> )>> > ) (T )>)> )> > > >> .RP>) (<==? .N 1> ) (T )>> ) "AUX" LEN) )> ) (T )> ) S2 (P2 ) (GWIM-NOW <>) (SYN VERB-SYNTAX> >)) > >> <1? .P2>> .PREP) (T .S2)>>> >>> > ) (> 1> > > VERB-SYNTAX> >> ) (T .GS>)>) (T VERB-SYNTAX> >>)>>> "Reduction for case of verb with no objects. If OK, win. Otherwise, try defaulting (and go to case of verb with one object)/orphaning..." > ) (T )>)> > >> > :FIX>> ;"Verb can take no args, so this flies" > T ;,PARSE-RESULT) (> > 1>>> T ;,PARSE-RESULT) (> > 1>>> > 2>> T ;,PARSE-RESULT)>)>)>> > >> )> .VERB> > ) (T )>)> > > ; ;"RED-SVNP depends on these POPs" >> > > > >> ; ;"SWG 28-Jul-88" >> >) (> > >> ) (T ,PARSE-RESULT)>) (> >> ; ;"SWG 28-Jul-88" >> >) (T > 2>> ,PARSE-RESULT)>)>) ;(T >)>)>> > ) (T )>)> > > ;"PICK OBJECT UP = PICK UP OBJECT" > > ) (T T)>> > ) (T )>)> > > > ; ,W?SAY> ,W?TO> ,INTQUOTE>> ;"etc." )> ; > ) OBJ1 OBJ2 SYN) ;> ) (T )>)> > > 1>>)> > >)> >>> ) (>>> ) (>> ) (>> >) (>> >) ( ) (T T)>> > ) (T )>)> > > .TYP>> > ) (T )>)> > > 1 <>> >> ; > T ;,PARSE-RESULT> > ) (T )>)> > > .TYP>)>> > ) (T )>)> > > .A>>)> ,PARSE-RESULT> ,W?ONE> ;"All books except the red one..." >)> > )> > > > <==? ,IT >> ) ;(> ) (T )>)>> ) NOUN-PHRASE) ;"Just one thing" > ;"Returns a noun-phrase, which we can then stuff into an NPP to be stuffed into the EXCEPT slot" > .NP)>) (T ;"NPP" .ENP) (GOOD <>) BAD) > .NP>> )> >> ) (T .RE>)>)>>)>> > <>) (WHICH: <>) "AUX" (SEARCH ) (T )>)>) (TEST ) (T )>)>) (PREP:VWORD ) (NP:PMEM ) (RLOC <>) (BIT 0) (MSG <>) "VALUE" ) ;5>)> ; )> .RL>) ;( ) ;() ( ) ( ) ;( ) ( ) (T .RL>)> :PMEM> :PMEM>>)> 'FIND-NOUN 'FIND-NUM > .SEARCH) (T 0)> .RLOC>> ; NP1 .NP>> ) (<0? :FIX> ) ( >) ;(T )>)>> ;:FIX> T) (T :FIX> )> > 2> <0? :FIX>> .DTP>)>>)>> >)> "Decide what object(s) OBJ refers to. If OBJ is false, we're looking to GWIM something. Otherwise, it's one of NP, NPP, or NOUN-PHRASE. In the last case, just return it, because it's already been reduced." NUM:FIX "OPT" (PICK <>) "AUX" (VAL <>) RES (COUNT:FIX 0) (SYN:VERB-SYNTAX ) (S-FLAGS:FIX ) (T )>) (SEARCH-ACT:FIX ) (T )>)) ;"Get What I Mean!" ;>)> > >> ) (T )>> >>> ;"Found one thing, so be happy" ; NP1 <>>>) (T ;"This will return an appropriate lossage so the parser will know to continue." > >) (T ,TLEXV ;,P-RUNNING)>> > > >> > >)> > .DO>)>) ( ;"Already a winner, so just return it" ) ( ) (<0? > >) (T ;"Do each noun phrase in turn, since we can take multiple objects" ) PTR) > ;"Remember how many objects we have" :PMEM>>> ;"And how many real objects we have" > ) (>> ) (T >)>>)> >> .DO>)> )>) (T .DO>)>> ;"Build a single noun phrase" -2> COUNT .COUNT>> ;"Copy everything into the single noun phrase" ) PHRASE TMP) > :FIX>> .RR .TMP> > >> )>> .RES)>> ) (CT ) ADJ PT) > 0> ) (> ,P-DIR-CODE> >> ,DEXIT>> ,FINDER T>> )> )>>> > ) (CT ) ADJ) > 0> ) (> ,W?INT.NUM> ;,TLEXV)) > > ) (>> )>>)>> .VAL)>> ;> ; > WHICH:FIX OBJ:PMEM "OPT" (MULTI <>) "AUX" (SYN: <>) (T )>) (ROBJ:PMEM .OBJ) (RLOC: <>) ;RNP QUANT: OWNER (RES <>) COUNT:FIX) >)> > :PMEM> ;> >)> > <0? >> > .DN>)> > > >> ; ;> > >>> > ; >)> ; ; 'FIND-SYNTAX .SYN 'FIND-WHICH .WHICH 'FIND-RES ,SEARCH-RES 'FIND-ADJS 'FIND-NUM 'FIND-NOUN 'FIND-OF ; .RNP> ;'FIND-EXCEPTIONS ;> > ;"Find owner in HERE" > > ;"Search for other owners." >)> ,W?HIMSELF> ;"ASK TROLL ABOUT HIMSELF" > > > )>>) (T )>)> ,W?HERSELF ;%> > > > ) (T )>)>> .DN>)> 'FIND-NUM 'FIND-NOUN 'FIND-OF ;.RNP> 'FIND-EXCEPTIONS > > >> >)> >> > >>> > ) ( >> >)>) ( ,P?GENERIC> ,SEARCH-RES ,FINDER>> ;"Protocol: returns .OBJ if that's the one to use, ,NOT-HERE-OBJECT if 'are none', [,ROOMS if case was handled and msg TELLed,] <> if WHICH-PRINT should be called" ; >>> ; .DN>) ( > ,GLOBAL-HERE) (T .RES)>>)> LENGTH <+ <* .COUNT 2> ,NOUN-PHRASE-MIN-LENGTH -2> COUNT .COUNT>> > ;"Store owner found." > >> ;> > > ) (T ; .SYN>) ;(T > .SYN>)>)>)> >> >)>) ( > .DN>)> > )> ; .RES> )) ) (>> > )>) (T ;"It's another table!" )> >>> > >> > ) (>> .RTD>)>>)>> > > )> > > ) (T )> > > > 1> >> )> > > )> >)>>>> > ) (T )>)> > > ;> ;"PARSER-ERROR-ORPH-S" )> > ;> )>> > ) (T )>)> >> > >> > ; ;>> > ;>>> ; > > 1) (T 0)>> ;> )>> ) "AUX" (GPTR ) PPTR TMP) > >>> ,LEXV-ELEMENT-SIZE-BYTES>>>) (T > ;"unreliable" .PPTR> ,LEXV-ELEMENT-SIZE-BYTES>>>) (T ;> ;,P-OLEN>)> >>>) ;(T >>>> >)> > ,G-LEXV .GPTR> ;>> )> >>> > >)> > >>> )) .ACT>) (> ,P-QUANT-CODE> ) (>> >>) (>>> .ACT>)> .CT > > > > > ) (SZ ) (REM .LEN)) ,FINDER T>> ) ;(T >)> > 1> ) (> 1> >> )> ;> ;>) (T >)>> > )> >> .A)>> )) ;> ) (T )>)> >)> > ,INTQUOTE>> > ,P-LEXV> 2>> )>)> ,P-ADJ-CODE> ;> > >> ;"Try as adjective instead." ;"Never returns?" )> > > > ;"PARSER-ERROR-ORPH-S: delete NO.WORD?" ; 1>> ) (T )) > > <+ 3 <* .N 2>>>)> > )> ;> > > > >) ( >)> > >)> > ;>> >> > ) (> ,W?THE> > ) ( ) (T > )>> >>)>>)> > ;> )>> > ) (T )>)> > T) (> ,W?COMMA> > ;>> > >> .ACT>) ( ,P-VERB-CODE>> .ACT>)>)> )>> > 1 <>> >> .ACT>)> > T) T)> (T >) (T )> > > )> ;>)> T> > > >> >> .ACT>)> > <* 2 .NUM>>> <* 2 .NUM>>> )> > >> > .X> > ) (T )>)> >)> > > )>)> .A1>>) ( .A2>>)> T> "Basic NP reduction. Doesn't do any checking at this level, just copies everything into a structure for later use." > ) (T )>)> > >)> ,P-COMMA-CODE ,P-EOI-CODE> ;> >)> > 1> >) (T > > >)>)> > "Reduction for FOO OF BARS" > ) (T )>)> > ,W?OF> >> > >> ;"ALL OF THE BOOKS = ALL BOOKS" > .ONP) (T .NP)>)>> "Reduction for case of a quantity by itself" > ) (T )>)> > > LEXBEG ,TLEXV LEXEND ,TLEXV>)>> > )>> ,NP-QUANT-TBL-LEN *204*>> 0>)>> "Quantity followed by a noun phrase: ALL RED BOOKS" > ) (T )>)> > ,NP-QUANT-NONE ,NP-QUANT-PLURAL>> ) (T ;"We don't distinguish ALL THE BOOKS from ALL THE BOOK." ,LEXV-ELEMENT-SIZE-BYTES>> >> .NP)>> "Basic top-level noun phrase reduction" ) (X1 <>) (X2 <>) (KLUDGE-FLAG <>)) ;> ) (T )>)> ;"Just an NP, so nothing interesting to do" ) (<==? .N 2> ;"NP/NPP followed by PP" > > ,W?BUT ,W?EXCEPT> ;"An exception, which isn't the same as a location" >;"Can't have exceptions to an NPP" .RED>) (> > > > > > )> )> )> ;"Doesn't make much sense otherwise" .RED>)>) (> ;"Try to make sense of it" .RED>)>) (>> ;"Died, set up orphaning and severity" .RED>)> .ONPP) ( ;"We have NP (disguised as NPP) followed by PP, so glue them together" >) (T .ONPP)>) (T ;"We have NPP followed by PP. NPP is produced only by NP CONJ NP" .ONPP) NP:PMEM) >>> )> >> ) ( )>>)>) (T ;"Case of NPP AND NP" > ,W?AND ;,W?OR ,W?COMMA> > NP> > ;"Prefer all (but foo and bar) over (all but foo) and bar..." .RED>)> > ) (T ) >> )> > .NPP)>)>)>> <>)) ;> ) (T )>)> > >) (<==? > ,W?OF> > ,W?OUT> ) (T .PP>)>) (<==? .TMP ,W?NOT> > ,W?BUT ,W?EXCEPT> T) (T .PP>)>)> )>> > ; ; ; ; > ) (T )>)> ,W?S> ) ( ,W?APOSTROPHE> ) (T )>)>> > ) (T )>)> ;"We die after four adjectives for now, since we don't have arbitrary storage allocation. Other possibilities exist for the future..." 1) (T > 1> >)> > ;"NP" ) ( ) ( > )> ) ( ;"ASK TROLL ABOUT HIS AX" > > > )>>) (T )> )> > > > ) (T )> )>> > > >> ) (T )>) (> >) ( ) ( T) ( .A2) ;(T )>> >:FIX ,ADJS-MAX-COUNT> ;"Make sure the adjective isn't already here..." ) (TCT:FIX )) > )> ) ;(T >)>> )> > >>)>) (T .RA>)> .A1)>> > ) (T )>)> > ; > > ) (T .ACT>)>) (>> .ACT>)> ;<* 2>> ;"Back up over NO.WORD">> > > 0> > >>) (T >>)> ;>> > ;"LOOK UP 'WORM'" > <* 2 ,P-LEXELEN>>> ;>)> )> >>> )>>