1 /* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 /******************************************************************************/
30 /* Ferruccio Guidi <fguidi@cs.unibo.it> */
34 /******************************************************************************/
39 %token <string> ID STR
40 %token <MathQL.mqtref> REF
41 %token LPR RPR DLR SQT DQT EOF PROT SLASH FRAG QUEST STAR SSTAR
44 %token TRUE FALSE AND OR NOT IS
45 %token SELECT IN WHERE USE POS USEDBY PATT UNION INTER
51 %type <MathQL.mqtref> ref
52 %type <MathQL.mquery> query
60 | SLASH body { MQBD :: $2 }
61 | QUEST body { MQBQ :: $2 }
62 | SSTAR body { MQBSS :: $2 }
63 | STAR body { MQBS :: $2 }
64 | STR body { MQBC $1 :: $2 }
67 | SLASH SSTAR frag { MQFSS :: $3 }
68 | SLASH STAR frag { MQFS :: $3 }
69 | SLASH STR frag { try let i = int_of_string $2 in
70 if i < 1 then raise Parsing.Parse_error;
72 with e -> raise Parsing.Parse_error
76 | prot PROT body DQT { ($1, $3, []) }
77 | prot PROT body FRAG frag DQT { ($1, $3, $5) }
92 | MCONCL { MQMConclusion }
93 | CONCL { MQConclusion }
95 | rvar { MQStringRVar $1 }
96 | svar { MQStringSVar $1 }
97 | func rvar { MQFunc ($1, $2) }
102 | str IS str { MQIs ($1, $3) }
103 | NOT boole { MQNot $2 }
104 | boole AND boole { MQAnd ($1, $3) }
105 | boole OR boole { MQOr ($1, $3) }
106 | LPR boole RPR { $2 }
109 | PATT REF { MQPattern $2 }
110 | rlist UNION rlist { MQUnion ($1, $3) }
111 | rlist INTER rlist { MQIntersect ($1, $3) }
112 | USE rlist POS svar { MQUse ($2, $4) }
113 | USEDBY rlist POS svar { MQUsedBy ($2, $4) }
114 | SELECT rvar IN rlist WHERE boole { MQSelect ($2, $4, $6) }
115 | LPR rlist RPR { $2 }
118 rlist EOF { MQList $1 }