3 Author: Markus Wenzel, TU Muenchen |
3 Author: Markus Wenzel, TU Muenchen |
4 |
4 |
5 Pure outer syntax. |
5 Pure outer syntax. |
6 |
6 |
7 TODO: |
7 TODO: |
|
8 - add_parsers: warn if command name coincides with other keyword (if |
|
9 not already present) (!?); |
8 - constdefs; |
10 - constdefs; |
9 - axclass axioms: attribs; |
11 - axclass axioms: attribs; |
10 - instance: theory_to_proof (with special attribute to add result arity); |
12 - instance: theory_to_proof (with special attribute to add result arity); |
11 - witness: eliminate (!); |
13 - witness: eliminate (!); |
12 - result (interactive): print current result (?); |
14 - result (interactive): print current result (?); |
28 open OuterParse; |
30 open OuterParse; |
29 |
31 |
30 |
32 |
31 (** init and exit **) |
33 (** init and exit **) |
32 |
34 |
33 val contextP = |
|
34 OuterSyntax.parser false "context" "switch theory context" |
|
35 (name >> (fn x => Toplevel.print o Toplevel.init_theory (IsarThy.the_theory x) (K ()))); |
|
36 |
|
37 val theoryP = |
35 val theoryP = |
38 OuterSyntax.parser false "theory" "begin theory" |
36 OuterSyntax.parser false "theory" "begin theory" |
39 (name -- ($$$ "=" |-- !!! (enum "+" name --| (Scan.ahead eof || $$$ ":"))) |
37 (OuterSyntax.theory_header >> (Toplevel.print oo IsarThy.theory)); |
40 >> (fn x => Toplevel.print o |
|
41 Toplevel.init_theory (IsarThy.begin_theory x) IsarThy.end_theory)); |
|
42 |
38 |
43 (*end current theory / sub-proof / excursion*) |
39 (*end current theory / sub-proof / excursion*) |
44 val endP = |
40 val endP = |
45 OuterSyntax.parser false "end" "end current theory / sub-proof / excursion" |
41 OuterSyntax.parser false "end" "end current theory / sub-proof / excursion" |
46 (Scan.succeed (Toplevel.print o Toplevel.exit o Toplevel.proof IsarThy.end_block)); |
42 (Scan.succeed (Toplevel.print o Toplevel.exit o Toplevel.proof IsarThy.end_block)); |
|
43 |
|
44 val contextP = |
|
45 OuterSyntax.parser true "context" "switch theory context" |
|
46 (name >> (Toplevel.print oo IsarThy.context)); |
|
47 |
|
48 val update_contextP = |
|
49 OuterSyntax.parser true "update_context" "switch theory context, forcing update" |
|
50 (name >> (Toplevel.print oo IsarThy.update_context)); |
47 |
51 |
48 |
52 |
49 |
53 |
50 (** theory sections **) |
54 (** theory sections **) |
51 |
55 |
510 "?", "[", "]", "and", "as", "binder", "infixl", "infixr", "is", |
514 "?", "[", "]", "and", "as", "binder", "infixl", "infixr", "is", |
511 "output", "{", "|", "}"]; |
515 "output", "{", "|", "}"]; |
512 |
516 |
513 val parsers = [ |
517 val parsers = [ |
514 (*theory structure*) |
518 (*theory structure*) |
515 contextP, theoryP, endP, |
519 theoryP, endP, contextP, update_contextP, |
516 (*theory sections*) |
520 (*theory sections*) |
517 textP, chapterP, sectionP, subsectionP, subsubsectionP, classesP, |
521 textP, chapterP, sectionP, subsectionP, subsubsectionP, classesP, |
518 classrelP, defaultsortP, typedeclP, typeabbrP, nontermP, aritiesP, |
522 classrelP, defaultsortP, typedeclP, typeabbrP, nontermP, aritiesP, |
519 constsP, syntaxP, translationsP, axiomsP, defsP, theoremsP, lemmasP, |
523 constsP, syntaxP, translationsP, axiomsP, defsP, theoremsP, lemmasP, |
520 axclassP, instanceP, globalP, localP, pathP, useP, mlP, setupP, |
524 axclassP, instanceP, globalP, localP, pathP, useP, mlP, setupP, |