1 // Translation from Maple to Macsyma
3 // Copyright © 2021 Dan Stanger, all rights reserved.
4 // Copying is covered by the GNU General Public License (GPL).
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
19 <if(names)>[<names; separator=", ">],<endif>
21 function(name,args) ::= <<
22 <name>(<args; separator=", ">)
25 [<args; separator=", ">]
28 setify([<args; separator=", ">])
30 seqsansprefix(left,right) ::= <<
31 makelist(<left>,<right>)
33 intintervalexpr(left,right) ::= <<
34 makelist(i, i, <left>, <right>)
36 proc(name,parms,locals,statseq) ::= <<
37 <name>(<parms; separator=", ">):=block(<locals>
38 <statseq; separator=",\n">
41 procexpr(parms,locals,expr) ::= <<
42 lambda([<parms; separator=", ">],
48 <stat; separator=",\n">
50 ifstat(expr,statseq,elifclause,elseclause) ::= <<
51 if <expr> then (<statseq; separator=",\n" >)
52 <if(elifclause)><elifclause><endif>
53 <if(elseclause)><elseclause><endif>
58 ifelifstat(x,i,e) ::= <<
61 ifelifelsestat(x,i,ei,e) ::= <<
62 if <x> then (<i>) <ei> else <e>
67 elifclause(x,i) ::= <<
68 else if <x> then (<i>)
70 forin(name,expr,body) ::= <<
71 for <name> in <expr> <body>
73 forbodywhile(expr,statseq) ::= <<
74 while <expr> do (<statseq; separator=",\n" >)
76 forbodydo(expr,statseq) ::= <<
77 do (<statseq; separator=",\n" >)
79 assign(lvalue,exprseq) ::= <<
82 namebracket(n,e) ::= <<
83 <n>[<e; separator=",">]
94 setrelexp(op,l,r) ::= <<
103 notimplemented(name) ::= <<
104 <name> not implemented
106 isnull(name, op) ::= <<
107 visit <name> <op> was null