Interactive Parsing

version 3 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter 1 - Parser


    Section 0 - Silence the advance parser's clarification messages

    Include (-

    [ PrintInferredCommand from singleton_noun;
    ! ------------IP CHANGE HERE-----------------

    if (pre_command == INACTIVE)
    {

    ! ------------IP CHANGE DONE-----------------

        singleton_noun = FALSE;
        if ((from ~= 0) && (from == pcount-1) &&
            (pattern-->from > 1) && (pattern-->from < REPARSE_CODE))
                singleton_noun = TRUE;

        if (singleton_noun) {
            BeginActivity(CLARIFYING_PARSERS_CHOICE_ACT, pattern-->from);
            if (ForActivity(CLARIFYING_PARSERS_CHOICE_ACT, pattern-->from) == 0) {
                print "("; PrintCommand(from); print ")^";
            }
            EndActivity(CLARIFYING_PARSERS_CHOICE_ACT, pattern-->from);
        } else {
            print "("; PrintCommand(from); print ")^";
        }
        
    ! ------------IP CHANGE HERE-----------------
    }
    ! ------------IP CHANGE DONE-----------------
    ];

    [ PrintCommand from i k spacing_flag;

    ! ------------IP CHANGE HERE-----------------
    if (pre_command == INACTIVE)
    {
    ! ------------IP CHANGE DONE-----------------

    if (from == 0) {
    i = verb_word;
    if (LanguageVerb(i) == 0)
    if (PrintVerb(i) == 0) print (address) i;
    from++; spacing_flag = true;
    }
    for (k=from : k<pcount : k++) {
    i = pattern-->k;
    if (i == PATTERN_NULL) continue;
    if (spacing_flag) print (char) ' ';
    if (i == 0) { print (string) THOSET__TX; jump TokenPrinted; }
    if (i == 1) { print (string) THAT__TX; jump TokenPrinted; }
    if (i >= REPARSE_CODE)
    print (address) VM_NumberToDictionaryAddress(i-REPARSE_CODE);
    else
    if (i ofclass K3_direction)
    print (LanguageDirection) i; ! the direction name as adverb
    else
    print (the) i;
    .TokenPrinted;
    spacing_flag = true;
    }

    ! ------------IP CHANGE HERE-----------------
    }
    ! ------------IP CHANGE DONE-----------------

    ];


    -) instead of "Print Command" in "Parser.i6t".