expression:
    proc options(main);
    dcl
        sysin file,
        value float,
        token char(10) var;

    on endfile(sysin)
        stop;

    on error(1)
        /* conversion or signal */
        begin;
        put skip list('Invalid Input at ',token);
        get skip;
        go to restart;
        end;

    restart:
        do while('1'b);
        put skip(3) list('Type expression: ');
        value = exp();
        put skip list('Value is:',value);
        end;

    gnt:
        proc;
        get list(token);
        end gnt;

    exp:
        proc returns(float binary) recursive;
        dcl x float binary;
        call gnt();
        if token = '(' then
            do;
            x  = exp();
            call gnt();
            if token = '+' then
                x = x + exp();
            else
            if token = '-' then
                x = x - exp();
            else
            if token = '*' then
                x = x * exp();
            else
            if token = '/' then
                x = x / exp();
            else
            signal error(1);
            call gnt();
            if token ^= ')' then
                signal error(1);
            end;
        else
            x = token;
        return(x);
        end exp;
    end expression;
