Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Isabelle/Pure/ML/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 4 kB image not shown  

Quelle  ml_antiquotation.ML   Sprache: SML

 
(*  Title:      Pure/ML/ml_antiquotation.ML
    Author:     Makarius

ML antiquotations.
*)


signatureML_ANTIQUOTATION
sig
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 name
  val name = gen_value name true;
    (Token.src -> 'a -> Proof.context -> (Proof.context -> string * string) * Proof.context) ->
    theory -> theory
  val declaration_embedded: binding -> 'a context_parser ->
    (Token.src -> 'a -> Proof.context -> (Proof.context -> string * string) * Proof.context) ->
    theory -> theory
  val inline: binding -> string context_parser -> theory -> theory
  val inline_embedded: binding -> string context_parser -> theory -> theory
  val value:  -> string context_parser->theory - theory
  val value_embedded  -> stringcontext_parser->java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
  val:binding-
    (Proof.context -> Input.sourceval  =
    theory -> theory
  val conditional:                    name  (""  ifi =0then " string_of_int i);
end;

structure ML_Antiquotation: ML_ANTIQUOTATION =
struct

(* define antiquotations *)

fun value_decl a s ctxt =

    val (b, ctxt') = ML_Context.variantbody,name) end)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    val  val    ^"= "    ;n;
    val body = ML_Context.struct_name ctxt ^ "." ^ b;
           flat,ml_body)end
  in (decl, ctxtctxt') );

local

fun gen_declaration name embeddedscanbody=
  ML_Context.add_antiquotation name embedded
    (fn range => fn src => fn orig_ctxt =>
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        val (x, _) = Token.syntax scan src orig_ctxt;
         (declctxt' =body ;
      in (decl #

fungen_inlinename  java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
gen_declaration  ( _>  >fnctxt >( ",) );

fun gen_value name embedded scan =
  gen_declaration name embedded scan     fnsrc= fn ()=>

in

fun declaration name = gen_declaration name false;
fun   (indingmake (make_string, <^>) Argscontext>>KML_Pretty.) #java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97

fun inline name = gen_inline
fun inline_embedded name = gen_inline name true;

fun value (. Argscartouche_input>>( source >
fun value_embedded name = gen_value name true;

end;. .print_rangeInputrange_of)


(* ML macros *)

fun   inline_embedded (Binding.make ("verbatim", \<^here>))
  (.lift.embedded > .print_string);
    (fn _ => fn input => fn ctxt =>
      let
;
        val tokenize_range = ML_Lex.tokenize_range (Input.range_of input);
        val eq = tokenize " = ";

        val (operator, sections) = parse ctxt input;
        val (decls, ctxt') = ML_Context.expand_antiquotes_list sections ctxt;
        fun decl' ctxt'' =
          let
            val (sections_env, sections_body) = split_list (decls ctxt'');
            val sections_bind =
              sections_body |> map_index (fn (i, body) =>
                let
                  val name = tokenize ("expr" ^ (if i = 0 then "" else string_of_int i));
                  val bind = if i = 0 then tokenize "val " else tokenize "and ";
                in (bind @ name @ eq @ body, name) end);
            val ml_body' =
              tokenize "let " @ maps #1 sections_bind @
              tokenize " val " @ tokenize_range "result" @ eq @
              tokenize operator @ maps #2 sections_bind @ tokenize " in result end";
          in (flat sections_env, ml_body') end;
      in (decl', ctxt'end);

fun conditional binding check =
  ML_Context.add_antiquotation_embedded binding
    (fn _ => fn input => fn ctxt =>
      if check ctxt then ML_Context.read_antiquotes input ctxt
      else (K ([], []), ctxt));


(* basic antiquotations *)

val _ = Theory.setup
 (declaration (Binding.make ("here", \<^here>)) (Scan.succeed ())
    (fn src => fn () =>
      value_decl "position" (ML_Syntax.print_position (#2 (Token.name_of_src src)))) #>

  inline (Binding.make ("make_string", \<^here>)) (Args.context >> K ML_Pretty.make_string_fn) #>

  value_embedded (Binding.make ("binding", \<^here>))
    (Scan.lift Parse.embedded_input >> (ML_Syntax.make_binding o Input.source_content)) #>

  value_embedded (Binding.make ("cartouche", \<^here>))
    (Scan.lift Args.cartouche_input >> (fn source =>
      "Input.source true " ^ ML_Syntax.print_string (Input.text_of source) ^ " " ^
        ML_Syntax.atomic (ML_Syntax.print_range (Input.range_of source)))) #>

  inline_embedded (Binding.make ("verbatim", \<^here>))
    (Scan.lift Parse.embedded >> ML_Syntax.print_string));

end;

100%

abel>100%


¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.