1 /* François Thomasset -- INRIA Rocquencourt -- Octobre 2001 *)
3 (* Translation from Maple to MuPad : syntaxic specification of maple *)
6 Copyright © 2001-2002 François Thomasset, all rights reserved.
7 All of Dan Stanger's changes are Copyright © 2021 Dan Stanger, all rights reserved.
8 Copying is covered by the GNU General Public License (GPL).
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
21 $Date: 2002/03/08 08:31:57 $
28 program : statseq EOF ;
29 // comments : COMMENT* -> skip ;
30 statseq : stat ((SEMICOLON|COLON) stat)* ;
31 stat : nameseq ASSIGN PROC LPAREN parmseq RPAREN result_type* decls_proc? statseq END #ProcStat
32 | nameseq ASSIGN exprseq #AssignStat
35 | SAVE name_string (COMMA name_string)* #StatStat
36 | IF expr THEN statseq elif_clause? else_clause? FI #IfStat
38 | for_in_stmt #ForInStat
43 | FOR name for_without_name
46 | FROM expr for_without_from
49 | BY expr TO expr for_body
50 | TO expr BY expr for_body
54 for_in_stmt : FOR name IN expr for_body ;
55 for_body : WHILE expr DO statseq OD #ForBodyWhile
56 | DO statseq OD #ForBodyDo ;
57 elif_clause : (ELIF expr THEN statseq)+ ;
58 else_clause : ELSE statseq ;
59 exprseq : expr (COMMA expr)* ;
60 expr : expr ARROW expr #ArrowExpr
61 | IF expr THEN exprseq elif_clause? else_clause? FI #IfExpr
63 | expr AND expr #AndOp
65 | expr OP=(CARET|EXP) expr #ExpoOp
66 | expr OP=(MULT|SLASH) expr #MultOp
67 | expr OP=(PLUS|SUBTRACT) expr #AddOp
68 | PLUS expr UPLUS #UnaryPlus
69 | SUBTRACT expr UMINUS #UnaryMinus
70 | expr AMPOP expr #NeutralOp
71 | expr AMPMUL expr #NeutralMulOp
72 // | expr (SEQ|SEQK) exprseq #SeqWithPrefix
73 | LBRACK? (SEQ|SEQK) LPAREN exprseq RPAREN RBRACK? #SeqSansPrefix
74 | PROC LPAREN parmseq RPAREN result_type* decls_proc? statseq END #ProcExpr
75 | expr OP=(LT|GT|LE|GE|NE|EQ) expr #BinaryRelOp
76 | expr MOD expr #ModOp
77 | INT ELLIPSE INT #IntIntervalExpr
78 | expr ELLIPSE expr #IntervalExpr
79 | expr OP=(INTERSECT|MINUS|UNION) expr #SetRelOp
80 | expr EXCLAM #Factorial
81 | QUOTE expr QUOTE #UnevaluatedExpr
82 | LBRACK exprseq? RBRACK #ListExpr
83 | LBRACE exprseq? RBRACE #SetExpr
86 | name functional_operator #FunctionalOperatorExpr
88 | INT DOT INT #FloatExpr
91 | LPAREN exprseq RPAREN #ParenExpr
92 | expr AT expr #ComposeExpr
93 | expr REPEAT_COMPOSE expr #RepeatComposeExpr ;
94 name : name_string #NameString
95 | name DOT INT #NameDotInt
96 | name DOT name_string #NameDotString
97 | name DOT LPAREN expr RPAREN #NameDotExpr
98 | name LBRACK exprseq RBRACK #NameBracket ;
100 | LPAREN exprseq RPAREN (LBRACK exprseq RBRACK)?
101 | functional_operator LPAREN exprseq RPAREN ;
102 parmseq : oneparm (COMMA oneparm)* ;
103 result_type : DOUBLE_COLON name_string SEMICOLON ;
105 | name DOUBLE_COLON name_string ;
106 nameseq : name (COMMA name)* ;
107 decls_proc : options_of_proc
110 | locals_of_proc globals_of_proc
111 | globals_of_proc locals_of_proc ;
113 | LOCAL nameseq SEMICOLON ;
115 | GLOBAL nameseq SEMICOLON ;
116 options_of_proc : OPTION nameseq SEMICOLON ;
119 | DOUBLEQUOTE #DoubleQuote
121 | BACKQUOTE #BackQuote ;