"PARSER for BUREAUCRACY: (C)1987 Infocom, Inc. All rights reserved." > > > > > ;> > > ;> "Which noun phrase is being parsed?" ;> ;> ;> > > ; > > ; ; ; ; ; ;> > > ; "RETROFIX #36" "Parse-cont variable" ;> > ;> ;> ;> ;> "Orphan flag" ;> ;> > > ;> > > > ;> ;> ;> > > > > > <> <> <>>> > ; "FIX #44" > > > ; "Rest down to last slot used" > <* 2 .SLOT ,P-LEXELEN:FIX>>>> ; "Rest inbuf to somewhere safe..." :FIX>>> > >) (T )> ; "Now rest LEXV to slot we actually want to use" > ; "Save length byte of inbuf" > ; "Print the word into the inbuf" ; "Save stuff in lexv" > > >> ; "Restore first word of inbuf" T> ) (CT 1)) )> >)> > T>)>> " 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." ) "AUX" (PTR: ,P-LEXSTART) WRD (VAL 0) (VERB <>) (OF-FLAG <>) (CNT-OMERGED -1) (LEN:FIX 0) (DIR <>) (NW 0) (LW 0) OWINNER) > ) (T >)> )>> > > > > > > > > > > > > >)> > > >> > ; ,VEHBIT>> >)> ;>)> ; "FIX #36" > )> > >) ( > > )>) (T > > ; ,VEHBIT>> >)> ;> > ) ( )> "> )> > > ,W?QUOTE> ; "Quote first token?" > ; "If so, ignore it." >)> ,W?THEN ,W?PLEASE ,W?SO> > ; "Ignore boring 1st words." >)> ,W?GO> ; "GO first input word?" >> ;" followed by verb?"> > ;"If so, ignore it." >)> .PARSER>) ( ,W?OOPS> > ,W?PERIOD ,W?COMMA> > >)> ; "FIX #38" > .PARSER>) ( ; "FIX #39" )> >> ;"Fixes OOPS w/chars" 6>> 7>> <+ <* ,P-LEXELEN:FIX> 3>> > > ) (T > .PARSER>)>) (T >)> ,W?AGAIN ,W?G> >> ; "FIX #50" .PARSER>) ( > ,W?PERIOD ,W?COMMA ,W?THEN> > ,W?AND>> >> :FIX 2>>) (T .PARSER>)>) (T > :FIX 1>>)> :FIX 0> ; "FIX #36" ) (T >)> ; > ; "FIX #44" > :FIX ,P-LEXELEN:FIX>>> )> > ,P-ITBLLEN:FIX> ) (T >)>>) (T > ; "Fixed BM 2/28/86" >)> > ; "FIX #37" :FIX>>>> >>:FIX >>:FIX>> > > .PARSER>)> > 0> > )> > >>> .PARSER>) ( > ; >> ) (T >>)> > ; ) ( ; > ; "FIX #40" > ) ( ;>> > )> ; "FIX #40" > ) ( >) (T )>)> >> ) (> ,ACT?WALK ,ACT?GO> > > ; > > >>> ,W?THEN>)> > > )>) (> > ; "For RUN, etc." 2>>>> >> >) (> > ; "Used to be >> but that loses, and isn't needed because VAL is set to 0 by the WT? anyway..." >> )> ; "1 IN RETROFIX #34" > > >> ; )> ; "Save OF-word" ) ( >> )>) ( .PARSER>) (T > > .PARSER>> > )>)>) ( ; "RETROFIX #34" > .PARSER>) (T >)>) () ( > .PARSER>) (T .PARSER>)>) (T .PARSER>)> >>)> > ; "FIX #44" > )> > > ; "FIX #44" > ) ; (T )> ; > )> ; "Why was this here?" ; > >> T)>> ) "AUX" X:FIX Y:FIX Z:FIX) >>> > >> >>> >> )> T> )) ,FATAL-VALUE> "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." > .BIT> T) (T > > >)> )>)>> "Scan through a noun phrase, leaving a pointer to its starting location:" ) (FIRST?? T) NW (LW 0)) 2>> > .VAL> .WRD> >) (T >)> > )> > >> .CLAUSE>)> > 0> >> )> > >>> .CLAUSE>) ( > ; >> ) (T >> ; "FIX" >>)>)> ; ,ACT?MAKE ,ACT?TAKE>> )> >>>> 4>>) ( > ) ( ) ( ; > > >)>) ( >> > >> .CLAUSE>) ;"3/16/83: This clause used to be later." ( > ;"10/26/84: next stmt changed" >> > ,W?THEN> >) ( >> .WRD>) ( ; "Word is also an adjective" ; "And is followed by a noun" > ; "kludge to allow teller to work well as adj and noun..." > ; "End the clause NOW, because not teller window or teller sign" 2>>> )>)> T) ( > >> 2>>> ) (T >)>) ; "Next clause replaced by following one to enable OLD WOMAN, HELLO" ; ( >> >>) ( > T) ( >> > ,W?THEN> >) ( T) (T .CLAUSE>)>) (T .CLAUSE>)> > >>> > >> ,RANDOM-PERSON> ) (<==? ,QCONTEXT ,NATIVES> ) (T >)> )> T> ,PLAYER ,NOT-HERE-OBJECT ,ME> >) ( >) ( > > ) (T )>) ( ) (T )> T> > > ) (> >) (T > )> T>)> > > ;> "Number of SEEVERBS" > > ) (I <>) "AUX" (V <>) OA OO OI ONP (WHO <>) ;(TUCH <>) (OP ,PERFORMING?) OV) #DECL ((A) FIX (O) (I) ) > >> )> > ; > )> > > ) (T )>) ( > ) (T )>)> ) (T )>) (T ,RANDOM-PERSON> ) (T >)> )> )> )>)> >> ) (T )> )> )> )>) (T ) (T )> )>)> > )> > )> )> )>) (T ) (T )> )>)> )> > )> )> )>) (T ) (T )> )>)> )> )>)> > > > > >)>)> ; > > )> ) (T ,M-WINNER>>)>)> > ,P?ACTION> ,M-BEG>>)>)> >>)> ; > )> > > > ,P?CONTFCN>> >)>)> > > > ,P?CONTFCN>> >)>)> > >>)>) (T )> > >> >>)> >>)> >> ,P?ACTION> ,M-END>> )>)> > .V> ) "AUX" OBJ) > > > )>) (> )>)> >) (T )>> T) (T <>)>> > > > > > > > > > >> > > > > > > > > > > > > > > > > > > >> > > > > > > ; > > > > > > > ; > ; > > ; > > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >> > > <>) (> 2> > <>) (> 2> > <>) (> 2> > ) ( ) ( ) ( ) ( ) (T )> <>) (> 2> > <>) ( > <>) ( > <>) ( )> ,W?PERIOD) (T .WORD)>> > > >> T) (T <>)>> "For AGAIN purposes, put contents of one LEXV table into another." > > >> >> > > > > .MAX> )> >> >>>> "Put contents of one INBUF into another." 1>> > > 0> )>>> "Put the word in the positions specified from P-INBUF to the end of OOPS-INBUF, leaving the appropriate pointers in AGAIN-LEXV." > ) (T >> >>>)> > >> > )>> .LEN> T> ; ;> ; > .VAL) (T > 2>> > 3>> >> .CNT> > <- ,FIELD-DATA-OFFSET 1>> >>> .TCHR> ,W?ZZSTREET) (T <>)>)>> <>) (EXC <>) (DOLLAR <>) CCTR (TMP <>) NW (SAVED-PTR .PTR) (MINUS? <>)) > 2>> )> > 3>> >> > %> >> ; "Handle case of seat number (13b, whatever). Pseudo handler for seat will do the right thing with this. First make sure it ends with a letter, and is long enough" > > %> ; "kludge so 13-b works as well as 13b" >)> > ,W?INTNUM> ; "Got a real number before the seat letter, so win." > >>) (T >>)> ; "Get a code number for the seat..." 4> .CHR>> ) (T ; "Lost, so just give up" .NN>)>)> > 0> )> > > T) (> .NN>)> ) (> .NN>)> ) ( .NN>) (> ) ( 1>> 1>>> <- .CHR %>>>) (T .NN>)> >> >>) (T >)> > >>> )> .TMP>> > > 0> > :FIX 2>> )> > >>> 2> > 2> 2>>> 3> > 2> 3>>>>) (ELSE >)>) ( >)> ) ( > 2>> ; "Check synonyms from money object" >)> .NN>) ( ) ( .NN>) ( T) ( .NN>) ( T) (T >)> >>) (T )> >)> > ,W?MONEY) (T > ,W?INTNUM)>> > >> T) (> >> T) (ELSE <>)>> > 2>> > 3>> > 0> )> > > 2> .CC>)> > <- .CHR 48>>>) (T .CC>)> >> 100) ( <* 10 .SUM>) (T .SUM)>> "New ORPHAN-MERGE." ;> ) (ACT <>)) > > )> ) (T >)> > > > > ) WRD (WHICH 1)) > 0>> > > ) ( > > > )> > >>> .MERGE>) ( .MERGE>) ( 1> > > > > >)> )>) (T > ;>)> >) (T .MERGE>)>) ( 1> > > > > >)>)> > > ) (T .MERGE>)>) ( > > > .MERGE>) (T )> > > >)> > > ) (T > .MERGE>)>) ( ,PS?ADJECTIVE> ;"same as WT?" >> ) ( ) ( ,PS?OBJECT> .END>> ) (T )> )> > > )>>)>)> > > > ; 0>> > > ,P-ITBLLEN:FIX> ) (T >)>>> T) ( T) (T <>)>> > )) >) (T )> ,P-OCL1) (ELSE ,P-OCL2)> .ADJ> 0>> )> > T> "Print undefined word in input. PTR points to the unknown word in P-LEXV" > 0> ) (T > >)>>> >> > "\""> >> 2> 3>> > > "]" CR>> " Perform syntax matching operations, using 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 P-SYNTAX." ) "AUX" SYN LEN:FIX NUM:FIX OBJ (DRIVE1 <>) (DRIVE2 <>) PREP VERB) > .CHECK>)> >> > > ,P-SONUMS>> T) ;"Added 4/27/83" (> >> >>> ) ( > > ) ( > )>)> > 1> > ) (T .CHECK>)>) (T >)>> >>> ,P-SONUMS> 1> ; "Found first object, but need second" >) (T <>)> 0>)> 0>> .CHECK>)> ) ( >>> ) ( <>) (T ) (T )> ) ( ,PERSON>> ,PERSON>>> ) (T )> ) (T )> )> > ) (T )>> ) (T > )> <>)>> > ;"? ,P-OTBL?" ) (> >) (T > )>> )> > > > > ,P-ITBLLEN:FIX> ) (T >)>> )> > )> > ) ( > )>> .THE?>> )>> ) WRD (FIRST?? T) (PN <>) (SOMETHING? <>)) ) (T >) (T )> > >> >> >>> )> ) ( > > >> ) ( ) ( > ; ) (T > )> > 1> CHAR >>) (T )>) ( > ) ( > ) ( > ) ( > ) ( > ) (T >)> >)>)> >> .SOMETHING?> "List of words to be capitalised." > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >> > >) (T >:FIX 32>> :FIX 1> <+ :FIX 1>>)>> > )> > 0>> > )> 0>> > ; "Will it ever work? --SWG" )> T)>> "Pointers used by CLAUSE-COPY (source/destination beginning/end pointers)." ) "AUX" BEG END OBEG:FIX CNT:FIX B E (FLG <>)) > > > > .INSRT> )> )> >> ; "Place to do insert?" > > ; "Is this a normal case?" ; "Find out how many spaces to make" ; "Replacing name, so n-1" > ; "Do the first one" > )> > >>) (T )> ; "Still stuff left to put in" <* 2 .CNT>>> .END>> > ,P-WORDLEN>>> ; "Make the space" > > )> > > )>>)> >> > > ; "And fill it up" > > )> > > >>) (T 0> )>)>> ) ( ; "Other case, here just add the new word" )> .OCL> >>) (ELSE ; "Add the new word and the name..." >> )> )>) ( .OCL>)> >> .OBEG>>> > .OCL> >> )> >> )> 2>>> :FIX ,P-LEXELEN:FIX> 2>>>> 2>> .WRD> > ,PREPOSITIONS)) 2>> > .SIZE> .FIND>) ( .PREP> > .FIND>)>>> >> ,ROOMS) ( > > )> ,P-IT-OBJECT) (T > 1> > >> > )> )> .OBJ)>) (T <>)>)>> >> ; "second noun clause?" > ,P-PRSI>> ; "Try to find objects" .SNARF>)>)> >> ; "1st noun clause" > ,P-PRSO>> ; "Win if found objects..." .SNARF>)>)> > 1> >) (T >)>)> T> > > 0> )> > > ; > ,P-BUTS> T) (T .OBJ> >)> >> .NTBL> ) LEN WV WRD NW (WAS-ALL? <>) ONEOBJ) ;"Next SETG 6/21/84 for WHICH retrofix" > )> > >> )> ) (T > ) (T >)> >)>) ( > .SNARFEM>> ) ( >>> .SNARFEM>) ( >)>) (T > .SNARFEM>> >)>) ( >> ;"Next SETG 6/21/84 for WHICH retrofix" > .SNARFEM>> T) () () ( )>) ( >> ; "FIX #41" ) ( )>)> > > )>>> ) (OLEN:FIX 0) OBJ ADJ X XTBL) > ; )> )> > >) (> > )>)> > > )> .GET>)> > > )> )) ; )> ; )> ) (T )> ; )> ) (T )>)> :FIX .TLEN>> ; )> ) ( > > >> "?]" CR>)> ) ( >>> :FIX .LEN>> ) (T )> ; "LEN is the number of new objects found; TLEN is the number of objects already in the table from previous GET-OBJECTS" >>> ; "Rest the table down to one before the beginning of the problem" >> ; "Save what's there" > ; "Stuff the number of objects in" ; "Apply the generic" .TTBL>> ; "Restore the table" .GET>)> .OBJ> > > > )>)> >> .GET>) ( > ,P-OCL1) (T ,P-OCL2)>> :FIX 10> ) (T ,P-NC1) (T ,P-NC2)>> ; <>> )>) ( )> > > .GET>)>) ( .GET>) ( > ; "RETROFIX #33" > > ; ; > ) (T )>)> > > .GET>) ( ; )> )> >> > )> > > >> > "This MOBY-FIND works in both ZIL and ZIP." > > OBLIST>> >>)> <>) ( T) ( > T) ( > T) ( T) (> <>) ( T) ( T) (T <>)>> ; )> % ;>> ;"ZIP case" '> > >> >)> > ,LAST-OBJECT> )>>>) (T ;"ZIL case" ; "New version to run in muddle. Uses more-or-less identical algorithm as above..." ' ,ZOBJS-OBLIST> <==? > ,OBJECT-ATOM>> > >> >)>)>> .L>> ,ATOM-TABLE:VECTOR> ; > ) (T >)>> >)> > 1> >)> .LEN> > )) <==? .TBL ,P-PRSO>> ) ( <==? .TBL ,P-PRSI>> )>)> .MT? > > )> ) ( >) (T >)> ) (T )> > > > )> ) ( )> > 1> )>>> > > )> > > ; )> > >> )> )>)> > .RMGL> )>>)> ; "New theory of pseudos. THINGS property is table: first element is function to call to do the match, second is argument to pass to that function along with adjective/noun stuff. Function either returns <>, object, or fatal. Fatal means you lose immediate..." :FIX> >> ,P-ADJ ,P-NAM >> ) (T .CHECK>)>)>)> .LEN> > )>)>)>> > ) (T ) ( ) (T T)>)>> ) "AUX" (ALL? <>)) > )> > ) (> > )> > >> ; "big mother change, see what happens. Used to be >" ; "Don't search the pocket for ALL" >) ( >) (T ,P-SRCALL) (<==? .OBJ ,PLAYER> ,P-SRCALL) (T ,P-SRCTOP)>>)>)> >>> >>> ; "Allow objects to match a particular number, rather than any number" .TI>)>)> <>) ( >> 2>> ; 2> 1>>>>> <>) ( >> 2>> ; >>>> <>) ( >> <>) ( > >> <>) (T T)>) (T T)>> >> ; "To get around EZIP bug on IBM and 6502" .PTR>>> > .OBJ> )>)> T> ) ( ) (T )> )> T> )) ; "GOT has three values: 0-->ain't got it; 1-->always had it; 2-->took it." > T) ( > > > .CHECK>)> ) ( > .CHECK>)> ) ( > .CHECK>)> ) ( > .CHECK>)> )> > > > > > >> > ; "Special code for convenience" ; "If the wallet's in the pocket..." > ) (T )>) (> )> ; "Got is true if wallet is in hand" > )>)>) ( ) ( > <==? ,WINNER ,PLAYER>> ) ( > ) ( > ) (> ) (T )> > > > ) ( ) (T > )>) ( ) (> ) (T )>)> )> .CHECK>) ;( > )>)> > .LEN> )>>)> T> ) TMP) :FIX 1> ,SMANY>>> ) (:FIX 1> ,SMANY>>> )> > ) ( > >) (T >)> <>) (T T)>> ; ;> ;) (RMBIT T) "AUX" OHERE (LIT <>)) > T) (T )> > ) (T > > )>)> :FIX 0> )>)> .LIT)>> "PICK-NEXT expects an LTABLE (length=number of strings), with an extra byte after the length that's initially 0." > .CNT>> > :FIX> )> .STR> ) "AUX" L O) > T) ( .HAVE>) ( > >> ) (T )> .HAVE>) (T > ) (T )> )>)> ) (T )>) (T )> T> )) ) (T )>) (T > )> )> T> "Number of HAVEVERBS." > "Number of TALKVERBS." > "Number of TOUCHVERBS" > "Number of HURTVERBS." > "# PUTVERBS." > "Number of MOVEVERBS." > > T) (T <>)>> T) (T <>)>> T) (T <>)>> > > ) ( >> > ) ( > ) ( >> > ) ( )> .HERE>) ( > >> )> >>)> .OBJ> > ,QCONTEXT) (T <>)>> ) VAL) > ) ( ) (T >)> .NOT-HERE>) (<==? ,P-XNAM ,W?D> .NOT-HERE>) ( > > )>) (T .NOT-HERE>)>)>) (T > > )>) (T .NOT-HERE>)>)>)> ) ( ) (T )> >> <==? ,P-XNAM ,W?ZALAGASAN>> ; > )> ,FATAL-VALUE> > ) (T )> <>) ( > ,P?GENERIC> .TBL>>> T) ( <>) (T <>)>) ( <>) ( T) (T ,NOT-HERE-OBJECT)>> )) > )> )>) ( <>>) (T <>>)>> > <>) (T T)>> >) (T >)> ) (> ; "Skip this guy if WINNER or NODESC" >) (T )>> .OBJ> ) "AUX" OBJ NXT (1ST? T) (IT? <>) (TWO? <>)) )> > ) (T ; "Get the next object that's not winner and not nodesc" .TST>> >) (T ) (T )>)> ,M-SHORT-OBJDESC>> >> ) (T )> )>)> )> > ) (T >)> ) (T > )> )>>)> ) (ELSE T)>> > )> > > T> ) "AUX" OBJ NXT STR (1ST? T) (TWO? <>) (IT? <>) (ANY? <>)) )> ; "Hide invisible objects" > T) (T )> > > )> > ; "If HERE, apply FDESCs and DESCFCNs and eliminate those objects" > ; "FDESCs" )> > > >> )> > > ; "DESCFCNs" )> > > > ; "Don't cause the thing to re-appear if describing it removes it" )>)> >)> ; "Print whatever's left in a nice sentence" > > > ) ( ) (T )>)>) (T ) (T )>)> )> > )> > ) (T >)> ) (T > )> )> )>>)> > ) ( ) (T )> >> )> )>> > .ANY>) (> >> )> >>> > <>) ( 2>> T) (T <>)>> <>) (> >> <>) (T > ,ROOMS ,GLOBAL-OBJECTS> <>) ( T) ( > <>) (T )>)>> )) )> > > ) (T <>)>>