Interactive Parsing

version 3 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Long words are stored as text

    Include (-

    Constant MAX_LONG_WORDS = 100;
    Global nine_plus_index_point = 0;
    Global longworderror_found = 0;
    Array nine_plus_words --> MAX_LONG_WORDS * 2;
    ! stored as word number // longer word as text string

    [ StoreLongerVersionOf n
        txt
        ;
        ! n is the dictionary number/address of the word
        


        txt = LocateTextEquivalentOf(n);
        if (txt ~= -1)
        {
            nine_plus_words-->nine_plus_index_point = n;
            nine_plus_words-->(nine_plus_index_point+1) = txt;
            nine_plus_index_point = nine_plus_index_point + 2;
            
        }
        else
        {
            #ifdef DEBUG;
                #ifdef LONG_WORD_CHECK_REPORT;
                    print "(Dictionary word ", (address) n, " is 9 letters long - does it need a text equivalent in the Longer Words table?)^";
                #endif;
            #endif;
        }
    ];


    [ RetrieveLongerVersionOf n
        i
        ;

        if (n >= dictstart)
        {

            if (DictionaryWordLength(n) < DICT_WORD_SIZE)
                return n;
            
            for (i = 0 : i < nine_plus_index_point : i = i + 2)
            {
                if (nine_plus_words-->i == n)
                    return nine_plus_words-->(i + 1);
            }
        
        }
        return n;
    ];


    -) before "Parser.i6t".

    Include (-

    Constant long_words_table = (+Table of Longer Words+);

    [ LocateTextEquivalentOf n
        max i
        ;
        max=TableRows(long_words_table);
        for ( i=1:i<=max:i++ ) {
            if (WordCompare(TableLookUpEntry(long_words_table, 1, i) , n))
                return TableLookUpEntry(long_words_table, 1, i);
        }
        return -1;
    ];

    -).

    Table of Longer Words
    word  
    "twenty-one"  
    "twenty-two"  
    "twenty-three"  
    "twenty-four"  
    "twenty-five"  
    "twenty-six"  
    "twenty-seven"  
    "twenty-eight"  
    "twenty-nine"  
    "transcript"  
    "superbrief"  
    "everything"  
    "inputchange"