/* Copyright (C) 2000, HELM Team. * * This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * * HELM is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HELM; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, * http://cs.unibo.it/helm/. */ /******************************************************************************/ /* */ /* PROJECT HELM */ /* */ /* Ferruccio Guidi */ /* 23/05/2002 */ /* */ /* */ /******************************************************************************/ %{ %} %token ID STR %token LC RC CM SC LP RP AT PC DL FS DQ EOF %token AND ATTR ATTRIB DIFF EQ FALSE FUN IN INTER NOT OR PAT REF REFOF %token REL SELECT SUB SUPER TRUE UNION WHERE %left DIFF %left OR UNION %left AND INTER %nonassoc NOT %start qstr ref query %type qstr %type query %% qstr: | QT { "" } | STR qstr { $1 @ $2 } ; svar: | PC ID { $2 } ; rvar: | AT ID { $2 } ; vvar: | DL ID { $2 } ; val: | MCONCL { MQMConclusion } | CONCL { MQConclusion } | STR { MQCons $1 } | rvar { MQStringRVar $1 } | svar { MQStringSVar $1 } | func rvar { MQFunc ($1, $2) } ; boole: | TRUE { MQTrue } | FALSE { MQFalse } | str IS str { MQIs ($1, $3) } | NOT boole { MQNot $2 } | boole AND boole { MQAnd ($1, $3) } | boole OR boole { MQOr ($1, $3) } | LPR boole RPR { $2 } ; rlist: | PATT REF { MQPattern $2 } | rlist UNION rlist { MQUnion ($1, $3) } | rlist INTER rlist { MQIntersect ($1, $3) } | USE rlist POS svar { MQUse ($2, $4) } | USEDBY rlist POS svar { MQUsedBy ($2, $4) } | SELECT rvar IN rlist WHERE boole { MQSelect ($2, $4, $6) } | LPR rlist RPR { $2 } ; query: rlist EOF { MQList $1 } ;