      SUBROUTINE TERM
      IMPLICIT NONE
C
      INCLUDE MATLAB$KOM:RECU.KOM
      INCLUDE MATLAB$KOM:IOP.KOM
      INCLUDE MATLAB$KOM:COM.KOM
C
      INTEGER R, OP, BSLASH, STAR, SLASH, DOT
C
      DATA BSLASH / 45 /, STAR / 43 /, SLASH / 44 /, DOT / 47 /
C
C
      IF (DDT.EQ.1) WRITE (WTE, 100) PT, RSTK(PT)
100   FORMAT (' TERM  ', 2I4)
      R = RSTK(PT)
      GO TO (99, 99, 99, 99, 99, 01, 01, 05, 25, 99,
     .       99, 99, 99, 99, 35, 99, 99, 99, 99), R
C
01    CONTINUE
      PT = PT+1
      RSTK(PT) = 8
C *CALL* FACTOR
      RETURN
C
05    CONTINUE
      PT = PT-1
10    CONTINUE
      OP = 0
      IF (SYM.EQ.DOT) OP = DOT
      IF (SYM.EQ.DOT) CALL GETSYM
      IF (SYM.EQ.STAR .OR. SYM.EQ.SLASH .OR. SYM.EQ.BSLASH) GO TO 20
      RETURN
C
20    CONTINUE
      OP = OP+SYM
      CALL GETSYM
      IF (SYM.EQ.DOT) OP = OP+SYM
      IF (SYM.EQ.DOT) CALL GETSYM
      PT = PT+1
      PSTK(PT) = OP
      RSTK(PT) = 9
C *CALL* FACTOR
      RETURN
C
25    CONTINUE
      OP = PSTK(PT)
      PT = PT-1
      CALL STACK2 (OP)
      IF (ERR.GT.0) RETURN
C
C ***      SOME BINARY OPS DONE IN MATFNS
      IF (FUN.EQ.0) GO TO 10
      PT = PT+1
      RSTK(PT) = 15
C *CALL* MATFN
      RETURN
C
35    CONTINUE
      PT = PT-1
      GO TO 10
C
99    CONTINUE
      CALL ERROR (22)
C      IF (ERR.GT.0) RETURN
C
      RETURN
      END
