Menu

#784 dot-operator precedence 110 ?

closed
nobody
Lisp Core (456)
5
2006-01-21
2005-09-18
No

-------------------------------------------------------------

Maxima version: 5.9.1
Maxima build date: 7:34 9/24/2004
host type: i686-pc-mingw32
lisp-implementation-type: Kyoto Common Lisp
lisp-implementation-version: GCL 2.6.5

-------------------------------------------------------------
(C54) a*[v1,v2] . b*[w1,w2];
(D54) [a*w1, a*w2]*([v1, v2] . b)
(C55) :lisp $C54
((MTIMES) $a ((MNCTIMES) ((MLIST) $v1 $v2) $b) ((MLIST)
$w1 $w2))
(C55) :lisp(describe 'mnctimes)
MNCTIMES - internal symbol in MAXIMA package
...
property RBP:
109
property LBP:
110
...
(C55) :lisp(describe 'mtimes)
MTIMES - internal symbol in MAXIMA package
...
property RBP:
120
property LBP:
120
...

I regard this information as the operator precedence,
or am I wrong?
If this is the precedence, D54 should be the result of
the following D55.

(C55) (a*[v1,v2]) . (b*[w1,w2]);
(D55) a*b*v2*w2 + a*b*v1*w1

Can someone explain, if the rbp and lbp values are the
operator precedence values and what the correct value
for dot is.

Volker van Nek

Discussion

  • Robert Dodier

    Robert Dodier - 2005-09-24
    • milestone: 482214 -->
     
  • Robert Dodier

    Robert Dodier - 2005-09-24

    Logged In: YES
    user_id=501686

    LBP and RBP are indeed operator precedence values (see
    "Syntax" under "Expressions",
    http://maxima.sf.net/docs/manual/en/maxima_toc.html\).
    However it is the LBP and RBP of the symbols $. and $* which
    are relevant to parsing input expressions; the parser sees
    only the atoms in the input stream, not MNCTIMES or MTIMES.

    LBP and RBP for input symbols are defined in
    src/nparse.lisp, which establishes () that "." has higher
    precedence than "*". However, for the purposes of display
    (essentially to determine which subexpressions need
    parentheses), src/grind.lisp establishes precedence for
    operators MNCTIMES, MTIMES, etc. The list in src/grind.lisp
    is out-of-date with respect to src/nparse.lisp -- in
    particular, "." has lower precedence than "*" there.

    The list in src/grind.lisp should be changed to have the
    same precedence values as in src/nparse.lisp.

    Whether "." should have higher or lower or the same
    precedence as "*", I don't know, and it is not immediately
    relevant, so I'm going to leave that alone.

     
  • Robert Dodier

    Robert Dodier - 2005-09-24

    Logged In: YES
    user_id=501686

    For the record -- pasting this here so that it doesn't get
    lost --

    (%i1) :lisp (do-symbols (s "MAXIMA") (if (get s 'mheader)
    (format t "~S ~S ~S ~S ~S ~S~%" (get
    (car (get s 'mheader)) 'lbp) (get (car (get s 'mheader))
    'rbp) (get s 'mheader) s (get s 'rbp) (get s 'lbp))))

    LBP RBP MHEADER OP RBP LBP

    160 NIL (MFACTORIAL) $! NIL 160
    80 80 (MNOTEQUAL) $# 80 80
    NIL NIL (NODISPLAYINPUT) $$ NIL -1
    NIL 201 (MQUOTE) |$'| NIL NIL
    NIL NIL (MPROGN) |$(| NIL 200
    120 120 (MTIMES) $* NIL 120
    100 100 (MPLUS) $+ 100 100
    NIL NIL ($EV) |$,| NIL 10
    100 100 (MMINUS) $- 134 100
    110 109 (MNCTIMES) $. 129 130
    120 121 (MQUOTIENT) $/ 120 120
    NIL 20 (MSETQ) |$:| 20 180
    NIL NIL (DISPLAYINPUT) |$;| NIL -1
    80 80 (MLESSP) $< 80 80
    80 80 (MEQUAL) $= 80 80
    80 80 (MGREATERP) $> 80 80
    NIL NIL (MLIST) $[ NIL 200
    140 139 (MEXPT) $^ 139 140
    180 20 (MDEFMACRO) |$::=| 20 180
    60 60 (MAND) $AND NIL 65
    NIL NIL ($GENFACT) $!! NIL 160
    140 139 (MEXPT) $** 139 140
    NIL 70 (MNOT) $NOT 70 NIL
    180 20 (MSET) |$::| 20 180
    180 20 (MDEFINE) |$:=| 20 180
    80 80 (MLEQP) $<= 80 80
    80 80 (MGEQP) $>= 80 80
    30 30 (MDO) $DO 25 25
    25 25 (MCOND) $IF 45 NIL
    50 50 (MOR) $OR NIL 60
    135 134 (MNCEXPT) $^^ 139 140
    NIL

     
  • Robert Dodier

    Robert Dodier - 2006-01-21
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 2006-01-21

    Logged In: YES
    user_id=501686

    I've committed changes to src/grind.lisp (r1.15) which
    modify the binding powers for MNCTIMES and other operators
    to make them the same as for the corresponding lexical
    tokens, so that the parser and the display code have the
    same ideas about operator precedence.

    The binding powers of lexical tokens was not changed, so
    expressions are still parsed in the same way as before; only
    display properties were changed.

    Closing this bug report as fixed.

     

Log in to post a comment.

MongoDB Logo MongoDB