X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql_test%2FmQGTopParser.mly;fp=helm%2Focaml%2Fmathql_test%2FmQGTopParser.mly;h=9fd70a033177100a8de150470e100abb4a2f05a2;hb=48b9bb5e9504aba97cff28a9d7e2797feb42972e;hp=0000000000000000000000000000000000000000;hpb=39c8c5c53680cd374a3eb76993a592cf29bb92ba;p=helm.git diff --git a/helm/ocaml/mathql_test/mQGTopParser.mly b/helm/ocaml/mathql_test/mQGTopParser.mly new file mode 100644 index 000000000..9fd70a033 --- /dev/null +++ b/helm/ocaml/mathql_test/mQGTopParser.mly @@ -0,0 +1,103 @@ +/* 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/. + */ + +%{ + let f (x, y, z) = x + let s (x, y, z) = y + let t (x, y, z) = z + + module G = MQueryGenerator +%} + %token ID + %token CONURI + %token VARURI + %token INDTYURI + %token INDCONURI + %token ALIAS EOF + + %start interp + %type CicTextualParser0.interpretation_codomain_item option> interp + + %token STR + %token DL DQ LC RC CM NOT + %token MOBJ MSORT MREL SOBJ SSORT OREL WOBJ WSORT + + %start qstr + %type qstr +%% + uri: + | CONURI { CicTextualParser0.ConUri $1 } + | VARURI { CicTextualParser0.VarUri $1 } + | INDTYURI { CicTextualParser0.IndTyUri ((fst $1), (snd $1)) } + | INDCONURI { CicTextualParser0.IndConUri ((f $1), (s $1), (t $1)) } + ; + alias: + | ALIAS ID uri { ($2, CicTextualParser0.Uri $3) } + ; + aliases: + | alias aliases { $1 :: $2 } + | EOF { [] } + ; + interp: + | aliases { function CicTextualParser0.Id s -> (try Some (List.assoc s $1) + with Not_found -> None) + | _ -> None } + ; + + qstr: + | DQ { "" } + | STR qstr { $1 ^ $2 } + ; +/* str: + | STR { $1 } + | DL ID { try G.builtin $2 with _ -> "" } + ; + strs: + | str CM strs { $1 :: $3 } + | str { [$1] } + | { [] } + ; + list: + | LC strs RC { $2 } + ; + not: + | NOT { true } + | { false } + ; + spec: + | MOBJ not list list list { G.MustObj ($2, $3, $4, $5) } + | MSORT not list list list { G.MustSort ($2, $3, $4, $5) } + | MREL not list list { G.MustRel ($2, $3, $4) } + | SOBJ not list list list { G.SOnlyObj ($2, $3, $4, $5) } + | SSORT not list list list { G.SOnlySort ($2, $3, $4, $5) } + | OREL not list list { G.OnlyRel ($2, $3, $4) } + | WOBJ not list list list { G.WOnlyObj ($2, $3, $4, $5) } + | WSORT not list list list { G.WOnlySort ($2, $3, $4, $5) } + ; + specs: + | spec specs { $1 :: $2 } + | EOF { [] } + ; +*/