Interactive Parsing

version 3 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter 2 - Dictionary

    Section 3 - Dictionary Access

    When play begins:
            set up dictionary access.

    To set up dictionary access:
        (- SetUpDictionaryAccess(); -).


    Include (-

    Global dictlen;
    Global entrylen;
    Global dictstart;

    [ SetUpDictionaryAccess;
    dictlen = #dictionary_table-->0; ! for use in later tokenisation
    entrylen = DICT_WORD_SIZE + 7;
    dictstart = #dictionary_table + WORDSIZE;
    ];


    [ IndexFromWord wordnum; ! word to dict position
        return (wordnum - dictstart) / entrylen;
    ];
    [ WordFromIndex i; ! dict position to word
        return entrylen * i + dictstart;
    ];

    -) before "Parser.i6t".