Original Parser

version 1 by Ron Newcomb

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 2 - Debugging this - not for release

    [ Specific to this project. ]

    To say (gt - a grammar token): (- DebugToken({gt}); -).
    [ if the gt is 'something':
            say "[']something[']";
        otherwise if gt is the end of line token:
            say "END";
        otherwise if gt >= 'something preferably held' and gt <= 'text':
            say gt;
        otherwise:
            say "[gt as a debugging number]".]

    To say (buf - a 1-based index based rulebook producing ZSCII letters): (- SayBuffer({buf}); -).

    Include (-
    [ SayBuffer buf ct_1;
        print "(", buf->LETTER_ARRAY_BASE, ")"; ! if size >255 then GLULX's size prints wrong
        style bold;
        for(ct_1 = WORDSIZE; ct_1 < 64; ct_1++ )
        {
            if (ct_1 == WORDSIZE + buf->LETTER_ARRAY_BASE) style roman;
            if (buf->ct_1 > 20) print (char) buf->ct_1;
            else print (char) '?';
        }
        style roman;
    ];-).

    To say the match list:
        let the previous group# be the 0th;
        repeat through the match list of size the number of objects in the match list:
            if the previous group# is the match list's groups element, next;
            if we should say the group as A\AN\SOME, say " [A match list element] ([the match list element as a debugging number]) --- group [0 - the match list's groups element][line break]";
            otherwise say " [The match list element] ([the match list element as a debugging number]) --- group [the match list's groups element][line break]";
            now the previous group# is the match list's groups element.