X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Ftex_cic_textual_parser%2FtexCicTextualParser.mly;h=3ca69d5c6d59ba9f0fd3701942f6c58a8f8ba97f;hb=78cf601fd8b8dbb386b0db315dcbfdbe8256c15f;hp=e26145e2855ba815dd03c1814750642ce40779aa;hpb=bac72fcaa876137ab7a5630e0c1badc2a627dce8;p=helm.git diff --git a/helm/ocaml/tex_cic_textual_parser/texCicTextualParser.mly b/helm/ocaml/tex_cic_textual_parser/texCicTextualParser.mly index e26145e28..3ca69d5c6 100644 --- a/helm/ocaml/tex_cic_textual_parser/texCicTextualParser.mly +++ b/helm/ocaml/tex_cic_textual_parser/texCicTextualParser.mly @@ -151,18 +151,20 @@ %token ID %token META %token NUM +%token RNUM %token CONURI %token VARURI %token INDTYURI %token INDCONURI -%token LPAREN RPAREN PROD LAMBDA COLON DOT SET PROP TYPE CAST IMPLICIT NONE +%token LPAREN RPAREN PROD LAMBDA COLON DOT SET PROP TYPE CPROP CAST IMPLICIT NONE %token LETIN FIX COFIX SEMICOLON LCURLY RCURLY CASE ARROW LBRACKET RBRACKET EOF %token DOLLAR -%token PLUS MINUS TIMES EQ +%token RPLUS RMINUS RTIMES RDIV +%token PLUS MINUS TIMES EQT EQ NEQT %right ARROW -%right EQ -%right PLUS MINUS -%right TIMES +%nonassoc EQ EQT NEQT +%left PLUS MINUS RPLUS RMINUS +%left TIMES RTIMES RDIV %start main %type Cic.term)> main %% @@ -178,32 +180,87 @@ main: */ ; expr2: - NUM + | RNUM + { [], function interp -> + let rec cic_real_of_real = + function + 0 -> Cic.Const (HelmLibraryObjects.Reals.r0_URI, []) + | 1 -> Cic.Const (HelmLibraryObjects.Reals.r1_URI,[]) + | n -> + Cic.Appl + [ Cic.Const + (HelmLibraryObjects.Reals.rplus_URI,[]) ; + Cic.Const (HelmLibraryObjects.Reals.r1_URI,[]); + cic_real_of_real (n - 1) + ] + in + cic_real_of_real $1 + } + | NUM { [], function interp -> let rec cic_int_of_int = function 0 -> - Cic.MutConstruct - (UriManager.uri_of_string "cic:/Coq/Init/Datatypes/nat.ind", - 0,1,[]) + Cic.MutConstruct (HelmLibraryObjects.Datatypes.nat_URI,0,1,[]) | n -> Cic.Appl - [ Cic.MutConstruct - (UriManager.uri_of_string "cic:/Coq/Init/Datatypes/nat.ind", - 0,2,[]) ; + [ Cic.MutConstruct (HelmLibraryObjects.Datatypes.nat_URI,0,2,[]) ; cic_int_of_int (n - 1) ] in cic_int_of_int $1 } + | expr2 RPLUS expr2 + { let dom1,mk_expr1 = $1 in + let dom2,mk_expr2 = $3 in + let dom = union dom1 dom2 in + dom, function interp -> + Cic.Appl + [Cic.Const (HelmLibraryObjects.Reals.rplus_URI,[]) ; + (mk_expr1 interp) ; + (mk_expr2 interp) + ] + } + | expr2 RMINUS expr2 + { let dom1,mk_expr1 = $1 in + let dom2,mk_expr2 = $3 in + let dom = union dom1 dom2 in + dom, function interp -> + Cic.Appl + [Cic.Const (HelmLibraryObjects.Reals.rminus_URI,[]); + (mk_expr1 interp) ; + (mk_expr2 interp) + ] + } + | expr2 RTIMES expr2 + { let dom1,mk_expr1 = $1 in + let dom2,mk_expr2 = $3 in + let dom = union dom1 dom2 in + dom, function interp -> + Cic.Appl + [Cic.Const (HelmLibraryObjects.Reals.rmult_URI,[]) ; + (mk_expr1 interp) ; + (mk_expr2 interp) + ] + } + | expr2 RDIV expr2 + { let dom1,mk_expr1 = $1 in + let dom2,mk_expr2 = $3 in + let dom = union dom1 dom2 in + dom, function interp -> + Cic.Appl + [Cic.Const (HelmLibraryObjects.Reals.rdiv_URI,[]) ; + (mk_expr1 interp) ; + (mk_expr2 interp) + ] + } | expr2 PLUS expr2 { let dom1,mk_expr1 = $1 in let dom2,mk_expr2 = $3 in let dom = union dom1 dom2 in dom, function interp -> Cic.Appl - [Cic.Const - (UriManager.uri_of_string "cic:/Coq/Init/Peano/plus.con",[]) ; + [Cic.Const (HelmLibraryObjects.Reals.rplus_URI,[]) ; (mk_expr1 interp) ; (mk_expr2 interp) ] @@ -214,8 +271,7 @@ expr2: let dom = union dom1 dom2 in dom, function interp -> Cic.Appl - [Cic.Const - (UriManager.uri_of_string "cic:/Coq/Arith/Minus/minus.con",[]) ; + [Cic.Const (HelmLibraryObjects.Peano.minus_URI,[]) ; (mk_expr1 interp) ; (mk_expr2 interp) ] @@ -226,8 +282,7 @@ expr2: let dom = union dom1 dom2 in dom, function interp -> Cic.Appl - [Cic.Const - (UriManager.uri_of_string "cic:/Coq/Init/Peano/mult.con",[]) ; + [Cic.Const (HelmLibraryObjects.Peano.mult_URI,[]) ; (mk_expr1 interp) ; (mk_expr2 interp) ] @@ -239,8 +294,7 @@ expr2: let dom = union dom1 (union dom2 dom3) in dom, function interp -> Cic.Appl - [Cic.MutInd - (UriManager.uri_of_string "cic:/Coq/Init/Logic/eq.ind",0,[]) ; + [Cic.MutInd (HelmLibraryObjects.Logic.eq_URI,0,[]) ; (mk_expr3 interp) ; (mk_expr1 interp) ; (mk_expr2 interp) @@ -366,9 +420,10 @@ expr2: } | IMPLICIT { mk_implicit () } - | SET { [], function _ -> Sort Set } - | PROP { [], function _ -> Sort Prop } - | TYPE { [], function _ -> Sort Type } + | SET { [], function _ -> Sort Set } + | PROP { [], function _ -> Sort Prop } + | TYPE { [], function _ -> Sort Type } + | CPROP { [], function _ -> Sort CProp } | LPAREN expr CAST expr RPAREN { let dom1,mk_expr1 = $2 in let dom2,mk_expr2 = $4 in