4 # Comments on one line are stripped
5 # Comments on many lines:
6 # nothing after *) (end of command)
7 # Commands could be nested (but see previous assumption)
8 # Commands don't span on several lines
9 # If a line is commented, the comment must begin at the begin of line and end
11 # In a line, before a command only spaces are allowed
14 $with_types = ($ARGV[1] ? ".types" : "");
23 <?xml version="1.0" encoding="ISO-8859-1"?>
24 <!DOCTYPE Theory SYSTEM "http://localhost:8081/getdtd?uri=maththeory.dtd">
26 <Theory uri="cic:/$curi">
32 $opencom-- if (/\*\)/ && !/\(\*.*\*\)/);
34 if (/\(\*.*\*\)/) { # (* comment *)
43 s/ *Require *(.*)\..*/$1/;
44 print "$ident<!-- Require $_ -->\n";
47 } elsif (/Section /) {
48 s/ *Section *(.*)\..*/$1/;
49 print "$ident<SECTION uri=\"$1\">\n";
51 } elsif (/Chapter /) {
52 s/ *Chapter *(.*)\..*/$1/;
53 print "$ident<SECTION uri=\"$1\">\n";
57 print "$ident</SECTION>\n";
58 } elsif (/Variable(s?) /) {
59 s/ *Variable(s?) *([^:]*):.*/$2/;
63 print "$ident<VARIABLE uri=\"$_.var$with_types\"/>\n";
65 } elsif (/Hypothesis /) {
66 s/ *Hypothesis *([^ :]*)( |:).*/$1/;
69 print "$ident<VARIABLE uri=\"$_.var$with_types\"/>\n";
71 } elsif (/^ *Inductive /) {
72 if (/ *Inductive *[^ :]+ ([^ :]*) :=/) {
73 s/ *Inductive *[^ :]+ ([^ :]*) *:=.*/$1/;
74 } elsif (/ *Inductive *[^ :]*( |:)/) {
75 s/ *Inductive *([^ :\[]*)( |:|\[).*/$1/;
77 print "$ident<DEFINITION uri=\"$_.ind$with_types\"/>\n";
78 } elsif (/ *CoInductive /) {
79 if (/ *CoInductive *[^ :]+ ([^ :]*) *:=/) {
80 s/ *CoInductive *[^ :]+ ([^ :]*) *:=.*/$1/;
81 } elsif (/ *CoInductive *[^ :]*( |:)/) {
82 s/ *CoInductive *([^ :]*)( |:).*/$1/;
84 print "$ident<DEFINITION uri=\"$_.ind$with_types\"/>\n";
85 } elsif (/^ *Fixpoint /) {
86 s/ *Fixpoint *([^ \[]*)( |\[).*/$1/;
87 print "$ident<DEFINITION uri=\"$_.con$with_types\"/>\n";
89 } elsif (/ *CoFixpoint /) {
90 s/ *CoFixpoint *([^ \[]*)( |\[).*/$1/;
91 print "$ident<DEFINITION uri=\"$_.con$with_types\"/>\n";
93 } elsif (/^ *Definition /) {
94 s/ *Definition *([^ :]*)( |:)?.*/$1/;
95 print "$ident<DEFINITION uri=\"$_.con$with_types\"/>\n";
97 s/ *Local *([^ :]*)( |:)?.*/$1/;
98 print "$ident<DEFINITION uri=\"$_.con$with_types\"/>\n";
100 s/ *Lemma *([^ :]*)( |:)?.*/$1/;
101 print "$ident<THEOREM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
103 } elsif (/Theorem /) {
104 s/ *Theorem *([^ :]+)( |:)?.*/$1/;
105 print "$ident<THEOREM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
107 } elsif (/Remark /) {
108 s/ *Remark *([^ :]*)( |:)?.*/$1/;
109 print "$ident<THEOREM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
111 } elsif (/Scheme /) {
112 s/ *Scheme *([^ :]*)( |:)?.*/$1/;
113 print "$ident<THEOREM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
116 } elsif (/Save / && $opengoal) {
117 s/ *Save *([^ \.]*)( |\.).*/$1/;
118 print "$ident<THEOREM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
120 } elsif (/with / && $openscheme) {
121 s/ *with *([^ :]*)( |:).*/$1/;
122 print "$ident<THEOREM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
124 } elsif (/with / && $openfix) {
125 s/ *with *([^ :]*)( |:).*/$1/;
126 print "$ident<DEFINITION uri=\"$_.con$with_types\"/>\n";
129 s/ *Axiom *([^ :]*)( |:).*/$1/;
130 print "$ident<AXIOM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
132 } elsif (/Parameter /) {
133 s/ *Parameter *([^ :]*)( |:).*/$1/;
134 print "$ident<AXIOM id=\"id$cid\" uri=\"$_.con$with_types\"/>\n";
136 } elsif (/Record /) {
137 s/ *Record *([^ :]*)( |:).*/$1/;
138 print "$ident<DEFINITION uri=\"$_.ind$with_types\"/>\n";
142 if ($openscheme && (/\./)) {
144 } elsif ($openfix && (/\./)) {