"PARSER for The Lurking Horror (c) Copyright 1986 Infocom, Inc. All Rights Reserved." "Parser global variable convention: All parser globals will begin with 'P-'. Local variables are not restricted in any way." > ;"agent of the action" > ;"the verb" > ;"the first object" > ;"the second object" "useful globals" > > > > ;"gets action associated with the verb" > > ;"T if last input was an orphan" > ;"T if this input was merged with an orphan" > ;"how many noun clauses we've seen" > ;"T if we're in quoted text (or winner,verb)" > ;"T if the sentence ended on a prep." > ;"T if seen an AND in a noun clause" > "tables and globals for looking at the input" > ;"offset of more to parse, <> if done" ;"saves number of words left to be examined" ;"Byte offset to # of entries in LEXV" ;"Word offset to start of LEXV entries" ;"Number of words per LEXV entry" ;"number of bytes per LEXV entry" > > > > > ;"INBUF - Input buffer for READ" > "table and offsets for oops info" <> <> <>>> ;"word pointer to unknown token in P-LEXV" ;"word pointer to sentence start in P-LEXV" ;"byte length of unparsed tokens in P-LEXV" ;"byte pointer to first free byte in OOPS-INBUF" "offsets in words" ;"Offset to parts of speech byte" ;"Offset to first part of speech" ;"First part of speech bit mask in PSOFF byte" "p-itbl -- state of the parse is stored here" > > "p-otbl -- just like p-itbl, for saving orphaned parses" > > "offsets in p-itbl and p-otbl" ;"length of p-itbl in words" ;"the action (act?foo)" ;"lexv entries for it" ;"first noun clause preposition" ;"word for it" ;"second noun clause preposition" ;"word for it" ;"start of first noun clause" ;"end of first noun clause" ;"start of second noun clause" ;"end of second noun clause" "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 <>) OWINNER OMERGED LEN (DIR <>) (NW 0) (LW 0) (CNT -1)) > ,P-ITBLLEN> ) (T >)> )>> > > > > ,VEHBIT>> >)> >)> > )> > >) (,P-CONT > )> >) (T > ,VEHBIT>> >)> > )> "> )> > )> > ,W?OOPS ,W?O> > ,W?PERIOD ,W?COMMA> > >)> > ) ( > ,W?QUOTE>> ) ( )> >> ;"maybe fix oops vs. chars.?" 6>> 7>> <+ <* ,P-LEXELEN> 3>> > > ) (T > )>) (T > )> >)> ,W?AGAIN ,W?G> > ) (,P-OFLAG ) ( ) ( > ,W?PERIOD ,W?COMMA ,W?THEN> > ,W?AND>> >> 2>>) (T )>) (T > 1>>)> 0> ) (T >)> ;> ) (T >)>>) (T > >>>> > >>> > ;> > 0> > ) (> ) (T >>)> ;"next clause added 8/20/84 by JW to enable TELL MY NAME TO BEAST" >>> ) ( > ) (ELSE )>)> ,W?QUOTE> > >>> ) (,QUOTE-FLAG >) (T )>)> >> )> ,ACT?PUSH> 0> ,W?CALL ,W?BUTTON ,W?ARROW>> ) ( )> )> >>> ,ACT?WALK ;,ACT?FLY> > >> > >>> ,W?THEN>)> > > )>) (>>> > 2>>>> >>) (>>> >> >>> > >> ) (> >> )>) ( ) (T > > >)> > > > > )>)>) ( > ) (T >)>) (>>) ( >> ;"Next expr added to fix FORD, TELL ME WHY" ;"NOT taken out of said expr to fix fix" > ) (T )>) (T )> >>)> > > ) (ELSE )> > > > T)>)>> > ) "AUX" (WRD <>) (NWRD <>)) > ) ( ) ( )>) (> >> ) (>) ( )> )> .WRD> >> > > > ) ( > >) (ELSE )>>)>> > > > > > "For AGAIN purposes, put contents of one LEXV table into another." > > > 2>> > 3>> > > )>>> "Put contents of one INBUF into another" 1>> > )>>> "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>> "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> ) ( 1) (T > > >)> )>) ( ) ( ) (ELSE )>)>> "Scan through a noun clause, leave a pointer to its starting location" ) (1ST? T) NW (LW 0)) 2>> > > .VAL> .WRD> >) (T >)> > )> > >> ,W?THE ,W?A ,W?AN> 4>>)> > 0> >> )> > ) (T >>)> >> > ) (ELSE )>) ( ) ( > >)>) ( >> ;"ADDED 4/27 FOR TURTLE,UP" >> > >> >) ;"This next clause was 2 clauses further down" ;"This attempts to fix EDDIE, TURN ON COMPUTER" ( 0>> > ,W?THEN> >) (>> >> T) ;"next clause makes 'give troll red book' have only one noun clause. careful!" (>> > >>) ( > >> 2>>> ) (T >)>) ;"next clause replaced by following on from games with characters" ;( 0>>> >>) (>> >>>) (>> T) (T )>) (T )> > >>> > > 2>> > 3>> > 0> ) (T > > > ) ( > )> <- .CHR 48>>>) (T )> >)>> >)> ,W?INTNUM> > ;"t if reading a time" ;"number to left of : in a time" ;"actual number found (NUMBER? substitutes INTNUM)" ) (ADJB <>) (VRB <>) (NOUN <>) ADJE WRD) > 0>> > )> )> )>)> ;"convert apparent verb into noun clause" > > > )> >>> >>> ) ( ) ( 1> 0 > > > >)> )>)> > >) (T )>) ( 1> <> > .NOUN>> > > >)>)> > > ) (T )>) (,P-ACLAUSE > > > ) (T > > >)> > ) (T > )>)> > ,PS?ADJECTIVE>> )> >) ( ,PS?OBJECT> .END>> >> > > )>)> > > )>>)>)> > > > ; 0>> > > ,P-ITBLLEN> ) (T >)>> T> ) (ADJE <>)) >)> > ) (ELSE )> 0>> > > > "Print undefined word in input. PTR points to the unknown word in P-LEXV" ) (ELSE > >)>>> >> 2> 3>> > >> >> 2> 3>> > >> " 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." ;"where the actual syntax found is saved" ;"location bits (where to look)" "definition of a syntax" ;"length in bytes" ) (DRIVE2 <>) PREP VERB TMP) >> )> >> > > ,P-SONUMS>> T) (> >> >>> ) ( > > ) ( > )>)> ) (T )>) (T >)>> >>> ) ( >>> ) ( ) (> ) (T > ) (> >) (T > )> )> ) (T )>> )>> )> > > > ) (T >)>> > > )> > > > )> > ) (.D2 > )>> ; > ) "AUX" BEG END) > >) (ELSE > >)> > ) (Q? <>)) ) (T > ) (.NOSP >) (ELSE )> ) ( ) ( ) (T .CP> )> ) ( > ) ( > ) (T >)> >)>)> >>> ;> >) (ELSE )>> ; >) (T > 32>> 1> <+ 1>>)>> > ) (T > )>)>> "CLAUSE-COPY" > ;"pointers used by CLAUSE-COPY (source/destination beginning/end pointers)" ;"slot in source to start from" ;"slot in source to end at" ;"which orphan table to use" ;"insertion beginning (from lexv)" ;"insertion ending" "do something about duplicate words in clause?" ) IEND OCL BEG END BB EE OBEG CNT B E) > > > > > > > > > )> )> >> )> > >> .OBEG>> 0>> > T> >> )> >> )> 2>>> ,P-LEXELEN> 2>>>> )> > >>> ) "AUX" OCL PTR) > > > > ) (ELSE > .WRD> )>> > ) ( .PREP> >>) (ELSE >)>>> >> )> > 1> > > > >> )> ) (ELSE )> ) (ELSE )> .OBJ)>) (T )>> > 0>> > ,P-PRSI> >)> > 0>> > ,P-PRSO> >)> >> > >)> >>> >)>)> > % ">) (ELSE > > )> >)>>> > ) (> ,P-BUTS>) (T .OBJ> >)> >> .NTBL> "ADJ/NOUN COMBINATION" > > > "AMBIGUOUS ADJ/NOUN COMBINATION" > ;> "PSEUDO-OBJECT ADJ-NOUN COMBINATION" > ;> > >> >> >> >> > > ) LEN WV WRD NW (WAS-ALL <>)) > )> > >> )> ) (T > ) (T >)> >)>) ( > > ) ( > ; >)>) (T > > >)>) ( >> > > T) (>>) () ( )>) (>>> ) ( )>)> > > )>>> "add an adjective value and name to the adjective table" ) (WRD <>) "AUX" N) > ) (ELSE > >)> )>> > > > 0> )>>> "magic bits for syntaxes" ;"HELD" ;"CARRIED" ;"IN-ROOM" ;"ON-GROUND" ;"TAKE" ;"MANY" ;"HAVE" ) ( >> ) ( )>> ) (OLEN 0) OBJ) > )> >>>> ,PS?OBJECT ,P1?OBJECT>>> >> > >) ( ,PS?DIRECTION ,P1?DIRECTION>>> )>)> > > > )> )> > > )> ) (T ,VEHBIT> >>> ,SOG ,SIR>)>)> )> .TLEN>> ;>>) ( >> > >> "?)" CR>)> ) ( >>> .LEN>> ) (T )> >> >> ) (>> ) (>>>> ,P-NC1) (T ,P-NC2)>> ; ; <>> ) (.VRB )> )>)> .GCHECK> > >> ;"Changed 6/10/83 - MARC" ) (T )>)> ) ( )> >> > ; > ) (T >)>> > 1> >) ( >> )> > .LEN> > > > > > ) G (N 0)) > .LEN> >) (ELSE ,P?GENERIC>> ) (> )>)>>)>> )> > ) (T )>) (,P-NAM ) (ELSE )>) (ELSE >)> )> > > ) (ELSE )> > )> ) ( )> > 1> )>> > ) (T )>> >>> > >> )> >)>> > > 1>> > )> >> )>)> )>>)> > > >> > > ,P-ADJNT> ;>>>> ;>> ;) (ELSE ;>)> >> 5>> > > )> > > )>>)> .LEN> ;> > )>)>> > ;"DO-SL outputs stuff to this table" > ) (T ) ( ) (T )>)>> > > > )> >) (ELSE )> > ,P-MOBY-FLAG>> > ,P-SRCALL) (T ,P-SRCTOP)>>)> >> )>>)>> > ;"table of actual noun used by player" > ;"table of actual adj used by player" >) ( >)> > .OBJ> >> > >>> > >> > 0> ) (T >> ) (> ) (T )>) ( ) (> ) (T )>)> > T) (T >) (>) ( > T>>) (T >)> > > ) ( ) ( ) (T )> ) (ELSE )> ) ( >> )>)>)>>) (T)>> > ) TMP) 1> ,SMANY>>> ) ( 1> ,SMANY>>> )> )> > ) ( >) (T >)> ) (T)>> )> > ) (ELSE >)> > >>) ( )>>> > ) ( )>>> )) > ) ( >> ) ( > ) ( > ) (T > > )>)> ,VEHBIT> ,OPENBIT>>> 1 1>)> 0> >)>)> .LIT> ;"former CRUFTY.ZIL routine" ) (> <- 2> 1>>>> ) (>>> >>> ) (ELSE > .SYNS <- 1>>> )> >> )>>)> > >> )>)> > > > >