Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#2577 Parser complains but doesn't err out on bad syntax

None
open
nobody
5
2013-06-17
2013-05-22
Stavros Macrakis
No

(%i17) 1 *** 2;
incorrect syntax: * is not a prefix operator
(%i17)
(%o17) 2

Apparently when it gets to "by", it throws out everything it's read so far, but leaves the rest of the line in the input buffer to be parsed. Then when it sees "do", it similarly throws out everything it's read so far. Then finally it reads 5 as though nothing preceded it.

It should of course have erred out leaving nothing in the input buffer.

Another similar case:

(%i24) for i by 4 do 5;
incorrect syntax: BY is an unknown keyword in a DO statement. <<< correct error msg
(%i24) incorrect syntax: DO is not an infix operator
(%i24)
(%o24) 5

Maxima 5.28 under XMaxima and wxMaxima under GCL on Windows

Discussion

  • Robert Dodier
    Robert Dodier
    2013-05-23

    I can't reproduce that behavior. I have tried it with Maxima post-5.30 (current Git) + GCL and also Clisp and CMUCL.

    GCL:

    (%i1) 1 *** 2;
    incorrect syntax: * is not a prefix operator
    1Space***Space
        ^
    (%i1) %o1;
    (%o1)                                 %o1
    (%i2) for i by 4 do 5;
    incorrect syntax: BY is an unknown keyword in a DO statement.
    forSpaceiSpacebySpace
           ^
    (%i2) %;
    (%o2)                                 %o1
    

    (The word "Space" is printed, but that's a separate problem.)

    Clisp:

    (%i1) 1 *** 2;
    incorrect syntax: * is not a prefix operator
    1 *** 
        ^
    (%i1) %;
    (%o1)                                  %
    (%i2) for i by 4 do 5;
    incorrect syntax: BY is an unknown keyword in a DO statement.
    for i by 
          ^
    (%i2) %;
    (%o2)                                  %
    

    CMUCL behavior is same as Clisp.

     
  • Robert Dodier
    Robert Dodier
    2013-06-17

    • labels: --> Lisp Core - Parser