//    CAE4



GET "SYNHDR"

LET RBCOM() = VALOF
   $(1 LET A, B, OP = 0, 0, SYMB

        SWITCHON SYMB INTO
     $( DEFAULT: RESULTIS 0

        CASE S.NAME:CASE S.NUMBER:CASE S.STRING:
        CASE S.TRUE:CASE S.FALSE:CASE S.LV:CASE S.RV:CASE S.VECAP:
        CASE S.LPAREN:
                A := REXPLIST()

                IF SYMB=S.ASS  THEN
                    $(  OP := SYMB
                        NEXTSYMB()
                        RESULTIS LIST3(OP, A, REXPLIST())  $)

                IF SYMB=S.COLON DO
                     $( UNLESS H1!A=S.NAME DO CAEREPORT(50)
                        NEXTSYMB()
                        RESULTIS LIST4(S.COLON, A, RBCOM(), 0)  $)

                IF H1!A=S.FNAP DO
                     $( H1!A := S.RTAP
                        RESULTIS A  $)

                CAEREPORT(51)
                RESULTIS A

        CASE S.GOTO:CASE S.RESULTIS:
                NEXTSYMB()
                RESULTIS LIST2(OP, REXP(0))

        CASE S.IF:CASE S.UNLESS:
        CASE S.WHILE:CASE S.UNTIL:
                NEXTSYMB()
                A := REXP(0)
                IGNORE(S.DO)
                RESULTIS LIST3(OP, A, RCOM())

        CASE S.TEST:
                NEXTSYMB()
                A := REXP(0)
                IGNORE(S.DO)
                B := RCOM()
                CHECKFOR(S.OR, 54)
                RESULTIS LIST4(S.TEST, A, B, RCOM())

        CASE S.FOR:
            $(  LET I, J, K = 0, 0, 0
                NEXTSYMB()
                A := RNAME()
                CHECKFOR(S.EQ, 57)
                I := REXP(0)
                CHECKFOR(S.TO, 58)
                J := REXP(0)
                IF SYMB=S.BY DO $( NEXTSYMB()
                                   K := REXP(0)  $)
                IGNORE(S.DO)
                RESULTIS LIST6(S.FOR, A, I, J, K, RCOM())  $)

        CASE S.LOOP:
        CASE S.BREAK:CASE S.RETURN:CASE S.FINISH:CASE S.ENDCASE:
                A := WORDNODE
                NEXTSYMB()
                RESULTIS A

        CASE S.SWITCHON:
                NEXTSYMB()
                A := REXP(0)
                CHECKFOR(S.INTO, 60)
                RESULTIS LIST3(S.SWITCHON, A, RDSECT(RDSEQ))

        CASE S.CASE:
                NEXTSYMB()
                A := REXP(0)
                CHECKFOR(S.COLON, 61)
                RESULTIS LIST3(S.CASE, A, RBCOM())

        CASE S.DEFAULT:
                NEXTSYMB()
                CHECKFOR(S.COLON, 62)
                RESULTIS LIST2(S.DEFAULT, RBCOM())

        CASE S.LSECT:
                RESULTIS RDSECT(RDBLOCKBODY)   $)1


AND RCOM() = VALOF
    $(1 LET A = RBCOM()

        IF A=0 DO CAEREPORT(51)

        WHILE SYMB=S.REPEAT LOGOR SYMB=S.REPEATWHILE LOGOR
                    SYMB=S.REPEATUNTIL DO
                  $( LET OP = SYMB
                     NEXTSYMB()
                     TEST OP=S.REPEAT
                         THEN A := LIST2(OP, A)
                           OR A := LIST3(OP, A, REXP(0))   $)

        RESULTIS A  $)1

.