"PARSER for MOONMIST Copyright (C) 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." ; > > > > "INBUF - Input buffer for READ" > > > <> <> <>>> "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" "Parse-cont variable" > > ">" "Orphan flag" > > > > > "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" ,PLUS-MODE> 6) (T 4)>> "Offset to first part of speech" ,PLUS-MODE> 7) (T 5)>> "First part of speech bit mask in PSOFF byte" > > > > "" > ;> > > > >>> > ;> >)> > > > > > T) (> > )> ,IT> )>> )> ,IT> )>>)> )> .OCNT) ( ; >) (T >)> .OCNT) ( > ; > .ICNT) (T ;.ICNT 1)>> <1? .ICNT>> >)> >>) (T >)>) (<0? .NUM> ,P-SONUMS>> > >) ( > ; > > >> > > ) (T > > ,PERSONBIT>> <==? ,PERSONBIT>>> ) (T )> > ) ( >) (T >>)> >)>) ( > >) (T ;"> )>" > > )> > )> > ) (T )> ) ( )> ) (T >) (T >)> 0> ,W?ALL>> > ) ( >> ) (> ) (<==? .OBJ1 ,PLAYER> ) ;( ) (T ) (T )>)> ) (T )> )>)> >> ) (T )> > )>)>>)> >)>) (T >)> > >> > )>)> > > >> > >>> )> )>> > ) ( ) ( ;> ) (T )>) ( ) (> ) (T )>) ( ) (> >> )> > > ) ;(T )>) ( >> ) (T )>)> > ) ( > ) (T )>) (> > ) (T )>) (T )>> )>> )>> ) (N 0)) <==? .PER ,PLAYER>>> ;"? more?" > ) ( > >> > )> >> > )> <==? ,WINNER ,PLAYER>> ;"? more?" )>)>> > > ;<==? ,HERE ,QCONTEXT-ROOM> <==? ,HERE >> )>> ) ( ) ;( ) ( )>> ) (OBJ <>)) ;"Protocol: return ,M-FATAL if case was handled and msg TELLed, <> if PRSO/PRSI ready to use" > ) ( ) (T )> ) ( ) ( )> ) (T )> )>)> ; > )> > )> > >> > > )>) (T )>)> ;"Here is the default 'cant see any' printer" ) (T )> > )> > ) (> > )>> ) (> ) ( ;"SHOW ME TO MY ROOM" )>)>)>> ; ) ( ) ( > > )>> >> ) (T )>> > > > )>)> )>> .LEN> > )> >> )>>> > > "Needed only for ZIL" "ZILCH should stick the # of the last object here" % ;>> ;"ZIP case" '> >> >)> )>>>) (T ;"ZIL case" ' > ) (T >)>> > 0> )> > 0> )> >>)> > > > >)> .LEN> if PRSO/PRSI ready to use" ;"Here is where special-case code goes. returns number of matches. If 1, then P-MOBY-FOUND is it. One may treat the 0 and >1 cases alike or different. It doesn't matter. Always return FALSE (not handled) if you have resolved the problem." > % > > ) (T ", ">)> > )>)>> > .M-F> )> > > 1> ) (ELSE )>)>> )>)> %)>> > > ) (> > >> ) ( ; ) (T )> ; ) ( > ,PERSONBIT>> ; ,GEN-TEST>> ) (> ) (T )> <>> )> %)>> ) ( ; ) (T )> ) ( > ,P?GENERIC> .TBL .M-F ;"?">>> ;"Protocol: returns .OBJ if that's the one to use, ,NOT-HERE-OBJECT if case was handled and msg TELLed, <> if WHICH-PRINT should be called" %)>> ) ( ) (.PRSO? ; ) (T )> ; ) ( > > > >> > > ) ( ) ( ) ;(> ) ;( ) ;(T )> > )> ) (T )> ) ( > )> ) (T ,NOT-HERE-OBJECT)>> )> )>) ( > ; <>>) (T > ; <>>)>> % ) ( ) ( )> )>>> > > >> >>>>> ) (T )> ) (T > >)> )> > >)> )> )>> > ) (<==? ,PERSONBIT> ) (T )> ;> ; ) (<0? > >) (T > )> ;> > ; > > ) (I <>) "AUX" V OA OO OI X) % % ') (T ' 1>>>)> ) (T )>)> )> )>> ;> ;>> ) (> > )>)> > )>)> > )>)>)> > > > > > ;)>)> > )> % ;"extra output for next (...)")>> ,M-WINNER>>)> ,CAR) (T ,HERE)> ; ,P?ACTION> ,M-BEG>>)> >>)> ; .I ;"This new clause applies CONTFCN to PRSI, BM 2/85" > > ,P?CONTFCN>> >)>)> .I> >>)> ; .O > > ,P?CONTFCN>> >)>)> .O >> >> ;)>)> >>)> ;> >> ,P?ACTION> ,M-END>>)>)> .V> ) "AUX" RES) % ) (T )>)>> )> >) (T >)> % ) ( ) (T )>)>> .RES)>> )) %> )>)>> > %)>> > > )>> ; > >> >> > >> >> >> >> > > > > > > >> > >> >> ; >> >> >> >> > >> > > >> >> >> > >>> > > > > > > ; > > >>> > > > > > > > > > > ;> > > > > > > > >> ; >> )) ) ( ) ( > ) ( > > > ) (T )> )>> > ;" " ; ; ; ;>> )>> ; ; ; >> !\] CR>)>> > " Grovel down the input finding the verb, prepositions, and noun phrases. 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 phrase lookup." > ) (OF-FLAG <>) LEN (DIR <>) (NW 0) (LW 0) (CNT -1) OMERGED OWINNER TMP) > ,P-ITBLLEN> ) (T >)> )>> > > > > > > ;> > > > > > >)> > > > > ,VEHBIT>> ; >)> >)> > > <==? ,PLAYER ,WINNER>> )> > ;>) (> ;> > <==? ,PLAYER ,WINNER>> )> ;> )>) (T > > >)> ,VEHBIT>> ; >)> > ;"to prevent pronouns w/o referents" ; > ; )> > ) (> 1> ) (T )> )> % ,PLUS-MODE> ' >>) (T '>)> )> > ;> 0> ;"for NW in SNARFEM" > > ;"Is quote first input token?" > ;"If so, ignore it." >)> > ;"Is THEN first input word?" > ;"If so, ignore it." >)> ,W?YOU> ;"Is this the first word ..." >> ;" followed by verb?"> > ;"If so, ignore it." >)> ,W?GO ,W?TO> ;"Is this the first word ..." >> ;" followed by verb?"> > ;"If so, ignore it." >)> ) ( ,W?OOPS> > ,W?PERIOD ,W?COMMA ,W?\!> > >)> > ) (> ;> ,P-LEXELEN>>> )> >> ; )> ;"Fixes OOPS w/chars" 6>> > <+ <* .VAL ,P-LEXELEN> 3>> ; )> > > >) (T > )>) ( >)> > ,W?AGAIN ,W?G> > ) (> ) ( ; ) ( >> ,W?PERIOD ,W?COMMA ,W?THEN> > >> 2>>) (T )>) (T > 1>>)> 0> ) (T >)> ;> ) (T >)>>) (T >>> > )> > > > > >>>)> > > ;"3/25/83: Next statement added." > 0> > ) (>> > >> ) (T >>)> > ; ) ( ;> > )> >> ) ( > > >) (T )>)> >> ) (> ,ACT?HEAD ;WALK> > > > > >>> ; )> ,W?THEN>)> > > )>) (> > )> 2>>>> >>) (> ; > ;>> <==? .NW ,W?OF> ;> <0? .VAL> > ;>> ;"Save OF-word" ) (> >> )>) (<==? ,P-NCN 2> ) (T > >> )> > )>)>) ;(<==? .WRD ,W?CLOSELY> ) ;( > ) ( > ) (T >)>) ( )>) ( > ) (T )>) (T )> >>)> > > > )> > > > )> 0> > > >)> ) ( ) (T )>)> > T)>> > > >> > <>> > > > "For AGAIN purposes, put contents of one LEXV table into another:" > > > 2>> > 3>> > > )>>> "Put contents of one INBUF into another:" ) (T >)>>> "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>> ) X) > > ) (<==? ,W?APOSTROPHE> >> >> > >> .VAL> ) ( )>> > )> > ,W?MY> )> > >> ,P-NAM> <==? .X>> ) ( )>> ;)>> ;% )>> > >> >> > )> > > > )> ;%)>> ;%)>> > >)> ) ( ;%)>> > ) (T > ;%" N .CHR>)>>)> ;%)>> >> >)> >)>> ,W?F.N) (<==? .TBL ,FAVE-COLOR> ,W?F.C) (T ,W?L.N)>)>> "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) ;"NEW-VOC" (T > > >)> )>)>> "Scan through a noun phrase, leaving a pointer to its starting location:" ) (FIRST?? T) NW (LW 0)) 2>> > > .VAL> .WRD> >) (T >)> > )> > >> ,W?THE ,W?A ,W?AN> 4>>)> > 0> >> )> >> > >> ) (T >> ;"added 8/14/86 SWG" >>)>)> ; ,ACT?MAKE ,ACT?TAKE>> )> >> ) ( ) ( > >)>) ( >> > >> >) ;"3/16/83: This clause used to be later." ( 0> >> > ,W?THEN> >) ( >> .WRD>) ( > ;"DRIVE CAR SOUTH" >>) ( > >> 2>>> ) (T >)>) () ( )>) ( 0>> > ,W?THEN> >) ( T) (T )>) (T )> > >>> > > >>> ) TMP) >> > > > 0> ) (T > > ) ( ) (> >> ) (T <- .CHR %>>>)> >)>> ) (.TIM )> >>)> ,W?INT.NUM> > ) (ADJB <>) (VRB <>) (NOUN <>) ADJE WRD) > > >> > )> )> )>)> ;"convert apparent verb into noun clause" > >> >>> )> >>> >>> ) ( ) ( 1> 0 > >> > >>>)> )>)> > >) (T )>) ( 1> <> > .NOUN>> >> > >>>)>)> > > ) (T )>) (,P-ACLAUSE > > > ) (T > >> >)> > ) (T > )>)> > ,PS?ADJECTIVE> ;"same as WT?" >> )> >) ( ,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 > >)>>> > )> ) ;(T )> ) ;(T )> >> 2> 3>> ; >> 2> 3>>)> > > ) ;(T )>> > > >> 2> 3>> ) ;(T )>> " 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." ) (DRIVE2 <>) PREP VERB) >> )> >> > > ,P-SONUMS>> T) ;"Added 4/27/83" (> <0? ,P-NCN> >> <==? .PREP >>> ) (<==? > <==? ,P-NCN 1>> ) (<==? > )>)> > ) (T )>) (T >)>> >>> ) ( >>> ) ;( ) (T > >> ) (T )> ) ( ,PERSONBIT>> ,PERSONBIT>>> ) (T )> ; ) (T )> ;) (T )>> ;"not in X1" > > )> > ) (T )>> ; ) (T ;> )> )>> ; > ) "AUX" TMP) > ;"? ,P-OTBL?" ) (T )>) ( <0? >> > ) (<==? .TMP ,W?X> ) (<==? .TMP ,W?Z> ) ( ) (<==? .TMP ,W?DIG> ) (<==? .TMP ,W?GET> ) (T )>) (T )>) (T > )> )>> )> > > > ) (T >)>> > > )> > > > )> > ) (.D2 > )>> .THE?>> ) WRD NW (FIRST?? T) (PN <>)) )> > >) (T )> > ;> > ) (T >)> > > ) (> > ) ( >> >> ; >>>> )> ) ( ) (T )> ;) ( ) ( > > > >> ) ( > ) ( ) (T .CP> > )>)> > ) ( > ) ( ;"VISIBLE check above" ;> ) ;( ;> ) ( ;> ) (T >)> >)> >>> ;>> ;>> > >) (T > 32>> 1> <+ 1>>)>> )> 0>> > >>> ) (T )> > ) (<==? .WRD ,W?THROUGH> ) (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> )>> 2>> ) (<==? .PREP> >>)>>> ) >> )> > 1> > > )> .OBJ)>) (T )>> "Which noun phrase is being parsed?" > "noun for PRSO & PRSI" > "adjective for ditto" > "noun before OF for ditto" "to make P-OFW work" > 0>> > ,P-PRSO>> )> > >)>)> > 0>> > ,P-PRSI>> )> >> 1> >) (T >)>)>)> > > ;> ) (> ,P-BUTS>> > )> >> .NTBL> > > > > > > "These three must be same length:" ;> ;> ;> ;> > > "> >" > "grabs the first adjective, unless it comes across a special-cased adjective:" )) ) ( ;"STUFFED x HEAD" ) ( ;"TALL BLOND(E) MAN" ) (;"x CONTACT LENS (why needed?)" ) ( ;"MY x OUTFIT" ) ( )>> ) LEN WV WRD NW (WAS-ALL <>) ONEOBJ) ;"Next SETG 6/21/84 for WHICH retrofix" > > > > )> ;" " > >> )> ) (T > ) (T >)> >)>) ( >> )> ) ( >)>) (T >> )> >)>) ( >> ;"Next SETG 6/21/84 for WHICH retrofix" >> )> T) ( )>) () (<==? .WRD ,W?OF> )>) (> >> ) ( )>)> > > )>>> > ) ;(T >)>) ( ) ( )> >>> >)>> ) (OLEN 0) (OBJ 0) (ADJ 0)) > )> > )> ,P-ADJ> > >) (> > > )>)> > <0? ,P-GWIMBIT>> )> )> > <0? ,P-SLOCBITS>> )> ) (T ; ,SOG ,SIR ;.TBL>)> ; ;"for CLUE-4"> )> )> )> .TLEN>> ) ( >> > >> >)> ) (> >>>> .LEN>> ) (T )> ;,P-NAM ; > .TBL .LEN>>>> ) (<==? .OBJ ,ROOMS> ;"SWG put it here 7/17/86" >) (T >> ; ; > > > )>) (>> ; )> > .TBL> ) (T )> <>> )>) (.VRB )> > > > )>)> .GCHECK> >> ; > > ;"> >" ) (T )>)> > > > ) (<0? .LEN> )> > >> )> > > > >> ,GENERIC-CLUE) (T >)> >> ) ;(<0? .LEN> ,NOT-HERE-OBJECT) (T >)>)>> > > ) ( ;"TAKE CLUE FROM JACK" > ) (<==? .OBJ ,P-IT-OBJECT> ) ;(> )>> ,STAIRS) (T ,BACKSTAIRS)>> ; ,STAIRS-0) ;( ,STAIRS-1) ;( ,STAIRS-2) ( ,STAIRS-1)>) ;( ,STAIRS-3) ( ,STAIRS-2)>) ;( ,STAIRS-3) ( ;"WING-ROOMS" ,STAIRS-NEW)>> ,NOW-WEARING)>> "use of WINDOW in CAR in COURTYARD:" ; ,WINDOW)>> ;> ,JACK-ROOM ;,JACK-DOOR) ( ,JACK-ROOM ;,JACK-DOOR)>> ;> ,LIBRARY ;,LIBRARY-DOOR) ( ,LIBRARY ;,LIBRARY-DOOR)>> ;> ,TAMARA-ROOM ;,TAMARA-DOOR) ( ,TAMARA-ROOM ;,TAMARA-DOOR)>> ;> ,LUMBER-ROOM ;,LUMBER-DOOR) ( ,LUMBER-ROOM ;,LUMBER-DOOR)>> > >) (<0? .TBL> )> )> >)> >> ,NOT-HERE-OBJECT) (<1? .LEN> ) (T >)>> > ,DINNER) ( ,A?MY> ,A?MY>> ,DINNER) ;(> ,NOT-HERE-OBJECT) (T ,NOT-HERE-OBJECT)>> >)> > >) (T >)>) ( > ) ( ) ( ) ( ) ( ) (T >)>) ( ) ( ) ( ) (T > ,P?STATION>> ) ( > )>>)> ) ( ) (T )>> ,HERE) ;"kludge!" ( ;"WING-ROOMS" ,GREAT-HALL) (T ,OLD-GREAT-HALL)>> ,LENS) (> ,LENS-1)>> > ,RECORDER)>> ,VIVIEN-BOX)>> ,BOOKS-GLOBAL)>> > ,WELL)>> ,SKELETON)>> ,GLASS-EYE)>> ,BELL)>> ,BOTTLE)>> )>) ( )>)>> ; > ) (T )>> > )> > ) ;( ) (T )> ) (T > )>) ( >) (T >)> > )>)> > > > > )> ) ( )> > 1> )>>)> > ) (T )>> > > ; ;"for CLUE-4" > )> )> )>>> > > )> > >> )> )>)> > > >> >>>> >> 5>> > > )> > > )>>)> .LEN> > ;)>)>)>> > ) (T ) ( ) (T )>)>> > > ; > )> > > ;> ,P-MOBY-FLAG >>> ;>> ,P-SRCALL) ( ,P-SRCALL) (T ,P-SRCTOP)> ;,P-MOBY-FLAG>)> >) (T )>>)>> > )> >> > )> > > > ) (<==? .L ,UEXIT> )>) (<==? .L ,DEXIT> ,OPENBIT> > )>) (<==? .L ,CEXIT> > > )>)>>> ) ( >> 2> 1>>>>> ) ( >> ,PLUS-MODE> '>) (T '>)>>>> ) (> >> )> > > > )> > > > >>> > > ;> > 0> )> >> > ) (T )>) (<==? .OBJ ,HER> > ) (T )>) (<==? .OBJ ,HIM> > ) (T )>) ;(<==? .OBJ ,THEM> > ) (T )>)> > >> ) (> >) ( <==? > T>> >) (T )> > > ) ( ) (T )> ) ;( <==? ,WINNER ,PLAYER>> )>)>>) (T)>> ) TMP) 1> ,SMANY>>> ) ( 1> ,SMANY>>> )> > ) (T )> > ) ( > >) (T >)> )>) (T)>> )> > ) (ELSE > > )>)> > ) (T )>) ( )>>> )> > ) (ELSE > > )>)> > ) (T )>) ( )>>> ;> ) (T )>) ( )>>> "source of light, 0=dark" ;"2=light here, 1=light from next room, 0=dark" ) (RMBIT <>) "AUX" OHERE (LIT <>) (P 0) TBL L) )> > >) (T )>)> ) (T ; > > )>)> ; >> >)> )> ) ( > ) (T >> >) ( ) ;"not up or down stairs" (> > > > > ) ( ,OPENBIT> > ) ( > > )>)>>)>> ;> ) (<0? > >) (T >)>> )) )> )> ) (T )> )> > ;)) )> > )> )> > ; > ;> > > )>> .WORD1 .WORD2 .WORD3> ) ( .WORD1 .WORD2 .WORD3> )>) (T .WORD1 .WORD2 .WORD3> ) ( .WORD1 .WORD2 .WORD3> )>)>> >) ( .WORD1 .WORD2 .WORD3> ) (T )>) (T >) ( .WORD1 .WORD2 .WORD3> ) (T )>)>>