//    LEX2


GET "SYNHDR"

LET D(S, ITEM) BE $( UNPACKSTRING(S, CHARV)
                     WORDSIZE := PACKSTRING(CHARV, WORDV)
                     LOOKUPWORD()
                     WORDNODE!0 := ITEM  $)

AND DECLSYSWORDS() BE
     $( D("AND", S.AND)
        D("ABS", S.ABS)

        D("BE", S.BE)
        D("BREAK", S.BREAK)
        D("BY", S.BY)

        D("CASE", S.CASE)

        D("DO", S.DO)
        D("DEFAULT", S.DEFAULT)

        D("EQ", S.EQ)
        D("EQV", S.EQV)
        D("ELSE", S.OR)
        D("ENDCASE", S.ENDCASE)

        D("FALSE", S.FALSE)
        D("FOR", S.FOR)
        D("FINISH", S.FINISH)

        D("GOTO", S.GOTO)
        D("GE", S.GE)
        D("GR", S.GR)
        D("GLOBAL", S.GLOBAL)
        D("GET", S.GET)

        D("IF", S.IF)
        D("INTO", S.INTO)

        D("LET", S.LET)
        D("LV", S.LV)
        D("LE", S.LE)
        D("LS", S.LS)
        D("LOGOR", S.LOGOR)
        D("LOGAND", S.LOGAND)
        D("LOOP", S.LOOP)
        D("LSHIFT", S.LSHIFT)

        D("MANIFEST", S.MANIFEST)

        D("NE", S.NE)
        D("NOT", S.NOT)
        D("NEQV", S.NEQV)

        D("NEEDS", S.NEEDS)

        D("OR", S.OR)



        D("RESULTIS", S.RESULTIS)
        D("RETURN", S.RETURN)
        D("REM", S.REM)
        D("RSHIFT", S.RSHIFT)
        D("RV", S.RV)
        D("REPEAT", S.REPEAT)
        D("REPEATWHILE", S.REPEATWHILE)
        D("REPEATUNTIL", S.REPEATUNTIL)

        D("SECTION", S.SECTION)
        D("SWITCHON", S.SWITCHON)
        D("STATIC", S.STATIC)

        D("TO", S.TO)
        D("TEST", S.TEST)
        D("TRUE", S.TRUE)
        D("THEN", S.DO)
        D("TABLE", S.TABLE)

        D("UNTIL", S.UNTIL)
        D("UNLESS", S.UNLESS)

        D("VEC", S.VEC)
        D("VALOF", S.VALOF)

        D("WHILE", S.WHILE)

        D("$", 0); NULLTAG := WORDNODE  $)

AND LOOKUPWORD() = VALOF

$(1     LET HASHVAL = (WORDV!0+WORDV!WORDSIZE >> 1) REM NAMETABLESIZE
        LET M = @NAMETABLE!HASHVAL

  NEXT: WORDNODE := !M
        UNLESS WORDNODE=0 DO
             $(2 FOR I = 0 TO WORDSIZE DO
                   IF WORDNODE!(I+2) NE WORDV!I DO
                   $( M := WORDNODE+1
                      GOTO NEXT  $)
                 RESULTIS WORDNODE!0  $)2

        WORDNODE := NEWVEC(WORDSIZE+2)
        WORDNODE!0, WORDNODE!1 := S.NAME, NAMETABLE!HASHVAL
        FOR I = 0 TO WORDSIZE DO WORDNODE!(I+2) := WORDV!I
        NAMETABLE!HASHVAL := WORDNODE
        RESULTIS S.NAME
$)1

.