src/Tools/isac/BridgeJEdit/parseC.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 03 Feb 2021 16:39:44 +0100
changeset 60154 2ab0d1523731
parent 60152 77a9287c56a3
child 60157 dd3a9eee47f2
permissions -rw-r--r--
Isac's MethodC not shadowing Isabelle's Method
walther@60044
     1
(*  Title:      Tools/isac/BridgeJEdit/parseC.sml
walther@60044
     2
    Author:     Walther Neuper, JKU Linz
walther@60044
     3
    (c) due to copyright terms
walther@60044
     4
walther@60044
     5
Outer token syntax for Isabelle/Isac.
walther@60044
     6
*)
walther@60044
     7
walther@60044
     8
signature PARSE_C =
walther@60044
     9
sig
walther@60044
    10
  type problem
walther@60044
    11
  val problem: problem parser
walther@60128
    12
  type problem_headline
walther@60128
    13
  val problem_headline: problem_headline parser
walther@60132
    14
walther@60128
    15
(* exclude "Problem" from parsing * )
walther@60128
    16
  val read_out_headline: headline_string * Token.T list -> ThyC.id * Problem.id
walther@60128
    17
( * exclude "Problem" from parsing *)
walther@60128
    18
  val read_out_headline: problem_headline -> ThyC.id * Problem.id
walther@60128
    19
(* exclude "Problem" from parsing *)
walther@60132
    20
  val read_out_problem: problem -> P_Spec.record
walther@60106
    21
walther@60132
    22
  val tokenize_formalise: Position.T -> string -> Fdl_Lexer.T list * Fdl_Lexer.chars
walther@60106
    23
walther@60106
    24
  type form_model = TermC.as_string list;
walther@60154
    25
  type form_refs = (((((string * ThyC.id) * string) * Problem.id) * string) * MethodC.id) * string
walther@60110
    26
  type form_model_refs = 
walther@60110
    27
    (((((string * string) * form_model) * string) * form_refs) * string) * string
walther@60106
    28
walther@60110
    29
  val read_out_formalise: form_model_refs -> Formalise.T list
walther@60106
    30
  (*RENAME TO parse_formalise..*)
walther@60122
    31
  val formalisation: Fdl_Lexer.T list -> form_model_refs * Fdl_Lexer.T list;
walther@60106
    32
walther@60045
    33
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@60044
    34
  val tokenize: string -> Token.T list
walther@60044
    35
  val string_of_toks: Token.T list -> string
walther@60044
    36
  val parse: (Token.T list -> 'a * Token.T list) -> Token.T list -> 'a * Token.T list
walther@60129
    37
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
walther@60044
    38
walther@60044
    39
  (*Model*)
walther@60044
    40
  type model
walther@60044
    41
  val model: model parser
walther@60044
    42
walther@60044
    43
  (*References*)
walther@60044
    44
  type refs
walther@60087
    45
  type model_refs_dummy = model * ((string * string) * refs)
walther@60087
    46
  val model_refs_dummy: model_refs_dummy
walther@60087
    47
  val references: ((string * string) * refs) parser
walther@60044
    48
  val refs_dummy: refs
walther@60044
    49
walther@60087
    50
  (*Specification*)
walther@60087
    51
  type specification = (string * string) * model_refs_dummy
walther@60087
    52
  val specification: specification parser
walther@60044
    53
walther@60044
    54
  (*Tactics *)
walther@60087
    55
  val check_postcond: (string * string list) parser
walther@60087
    56
  val rewrite_set_inst: ((string * string) * string) parser
walther@60087
    57
  val substitute: ((string * string) * string) parser
walther@60087
    58
  val exec_check_postcond: string * string list -> string
walther@60087
    59
  val exec_rewrite_set_inst: (string * string) * string -> string
walther@60087
    60
  val exec_substitute: (string * string) * string -> string
walther@60044
    61
walther@60087
    62
  val tactic: Token.T list -> (string * string) * Token.T list
walther@60044
    63
walther@60147
    64
  (*Steps*)
walther@60147
    65
  val steps: (string * (string * string)) list parser
walther@60147
    66
  val exec_step_term: string * (string * string) -> string
walther@60147
    67
  val steps_subpbl: string list parser
walther@60147
    68
walther@60044
    69
  (*Problem*)
walther@60087
    70
  type body
walther@60087
    71
  val body: body parser
walther@60087
    72
  val body_dummy: body
walther@60106
    73
walther@60110
    74
  val tokenize_string: Fdl_Lexer.chars -> Fdl_Lexer.T * Fdl_Lexer.chars
walther@60110
    75
  val scan: Fdl_Lexer.chars -> Fdl_Lexer.T list * Fdl_Lexer.chars
walther@60106
    76
  val parse_form_refs: Fdl_Lexer.T list -> form_refs * Fdl_Lexer.T list;
walther@60106
    77
  val parse_form_model: Fdl_Lexer.T list -> string list * Fdl_Lexer.T list;
walther@60106
    78
  val parse_string         : Fdl_Lexer.T list -> string * Fdl_Lexer.T list;
walther@60129
    79
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
walther@60044
    80
end
walther@60044
    81
walther@60044
    82
(**)
walther@60044
    83
structure ParseC(**): PARSE_C(**) =
walther@60044
    84
struct
walther@60044
    85
(**)
walther@60044
    86
walther@60096
    87
(**** Tools ****)
walther@60044
    88
walther@60044
    89
fun tokenize str =
walther@60044
    90
  filter Token.is_proper (Token.explode (Thy_Header.get_keywords' @{context}) Position.none str)
walther@60044
    91
walther@60044
    92
fun parse parser toks = Scan.finite Token.stopper (Scan.error parser) toks
walther@60044
    93
walther@60044
    94
fun string_of_toks toks = fold (curry op ^) (map Token.unparse toks |> rev |> separate ", ") "";
walther@60044
    95
walther@60044
    96
walther@60096
    97
(**** parse Calculation ****)
walther@60096
    98
walther@60044
    99
(*** Problem headline ***)
walther@60044
   100
walther@60128
   101
(* exclude "Problem" from parsing * )
walther@60044
   102
type problem_headline = (((((string * string) * string) * string) * string list) * string)
walther@60128
   103
( * exclude "Problem" from parsing *)
walther@60128
   104
type problem_headline = (((string * ThyC.id) * string) * Problem.id) * string
walther@60128
   105
(* exclude "Problem" from parsing *)
walther@60128
   106
val problem_headline = (*Parse.$$$ "Problem" --*)
walther@60044
   107
  Parse.$$$ "(" --
walther@60044
   108
    Parse.string -- Parse.$$$ "," --
walther@60044
   109
      (Parse.$$$ "[" |-- Parse.list1 Parse.string --| Parse.$$$ "]") --
walther@60044
   110
  Parse.$$$ ")"
walther@60044
   111
walther@60132
   112
(* exclude "Problem" from parsing * )
walther@60128
   113
fun string_of_headline ((((left, thy_id: ThyC.id), comm), pbl_id), right) =
walther@60128
   114
      left ^ thy_id ^ comm ^ Problem.id_to_string pbl_id ^ right
walther@60128
   115
fun read_out_headline ((((("(", thy_id), ","), pbl_id), ")"), []) = (thy_id, pbl_id)
walther@60128
   116
  | read_out_headline (hdl, toks) =
walther@60128
   117
      raise ERROR ("read_out_headline NOT for: (" ^ string_of_headline hdl ^ ", " ^
walther@60128
   118
        string_of_toks toks ^ ")")
walther@60132
   119
( * exclude "Problem" from parsing *)
walther@60128
   120
fun read_out_headline ((((("(", thy_id), ","), pbl_id), ")")) = (thy_id, pbl_id)
walther@60132
   121
  | read_out_headline arg =
walther@60132
   122
      (@{print} {a = "read_out_headline with", arg = arg}; raise ERROR "read_out_headline")
walther@60128
   123
(**)
walther@60128
   124
walther@60132
   125
(* used if at least "Problem (thy_id, pbl_id)" has been input *)
walther@60132
   126
fun read_out_problem ((((((
walther@60132
   127
    "(", thy_id), ","), pbl_id), ")"), (((((
walther@60132
   128
      _(*"Specification"*), _(*":"*)), (((((((((((((((
walther@60132
   129
        _(*"Model"*), (("", ""), "")), _(*":"*)),
walther@60132
   130
          _(*"Given"*)), _(*":"*)), givens),
walther@60132
   131
          _(*"Where"*)), _(*":"*)), wheres),
walther@60132
   132
          _(*"Find"*)), _(*":"*)), find),
walther@60132
   133
          _(*"Relate"*)), _(*":"*)), relates), ((
walther@60132
   134
        _(*"References"*), _(*":"*)), ((((((((
walther@60132
   135
          _(*"RTheory"*), _(*":"*)), rthy_id),
walther@60132
   136
          _(*"RProblem"*)), _(*":"*)), rpbl_id),
walther@60132
   137
          _(*"RMethod"*)), _(*":"*)), rmet_id)))),
walther@60132
   138
        _(*"Solution"*)), _(*":"*)),
walther@60132
   139
          _(*[]*))),
walther@60132
   140
       _(*""*)) =
walther@60132
   141
    {thy_id = thy_id, pbl_id = pbl_id,
walther@60132
   142
      givens = givens, wheres = wheres, find = find, relates = relates,
walther@60132
   143
      rthy_id = rthy_id, rpbl_id = rpbl_id, rmet_id = rmet_id}
walther@60132
   144
  | read_out_problem arg =
walther@60132
   145
    (@{print} {a = "read_out_problem called with", arg = arg};
walther@60132
   146
      raise ERROR "read_out_problem called with")
walther@60132
   147
walther@60044
   148
walther@60044
   149
(*** Specification ***)
walther@60044
   150
walther@60044
   151
(** Model **)
walther@60044
   152
walther@60044
   153
type model =
walther@60044
   154
  ((((((((((((((string * ((string * string) * string)) * string) * string) * string) *
walther@60044
   155
      string list) * string) * string) * string list) * string) * string) * string) *
walther@60044
   156
         string) * string) * string list);
walther@60044
   157
val model = (
walther@60152
   158
  Parse.keyword_improper "Model" --
walther@60044
   159
    (Scan.optional (*.. show, whether the Model refers to RProblem or to RMethod *)
walther@60044
   160
      (Parse.$$$ "(" -- (Parse.$$$ "RProblem" || Parse.$$$ "RMethod") -- Parse.$$$ ")")
walther@60044
   161
      (("", ""), "") ) --
walther@60044
   162
    Parse.$$$ ":" --
walther@60152
   163
    Parse.command_name "Given" -- Parse.$$$ ":" -- Parse.list1 Parse.term --
walther@60152
   164
    Parse.keyword_improper "Where" -- Parse.$$$ ":" -- Parse.list Parse.term --
walther@60152
   165
    Parse.command_name "Find" -- Parse.$$$ ":" -- Parse.term --
walther@60152
   166
    Parse.command_name "Relate" -- Parse.$$$ ":" -- Parse.list Parse.term
walther@60044
   167
)
walther@60044
   168
walther@60044
   169
(** References **)
walther@60044
   170
walther@60044
   171
type refs =
walther@60044
   172
  ((((((((string * string) * string) * string) * string) * string list) * string) * string) * string list)
walther@60044
   173
val refs_dummy =
walther@60044
   174
  (((((((("", ""), ""), ""), ""), []), ""), ""), [])
walther@60044
   175
walther@60044
   176
val references = (
walther@60044
   177
  Parse.$$$ "References" -- Parse.$$$ ":" (**) --
walther@60044
   178
    (Scan.optional 
walther@60044
   179
      (Parse.$$$ "RTheory" -- Parse.$$$ ":" -- Parse.string (**) --
walther@60044
   180
      Parse.$$$ "RProblem" -- Parse.$$$ ":" (**) --
walther@60044
   181
        (Parse.$$$ "[" |-- Parse.list1 Parse.string --| Parse.$$$ "]") (**) --
walther@60044
   182
      Parse.$$$ "RMethod" -- Parse.$$$ ":" (**) --
walther@60044
   183
        (Parse.$$$ "[" |-- Parse.list1 Parse.string --| Parse.$$$ "]")
walther@60044
   184
      )
walther@60044
   185
      refs_dummy
walther@60044
   186
    ))
walther@60044
   187
walther@60044
   188
(** compose Specification **)
walther@60044
   189
walther@60044
   190
type model_refs_dummy = (model * ((string * string) * refs))
walther@60044
   191
val model_refs_dummy = ((((((((((((((("", (("", ""), "")), ""), ""), ""),
walther@60044
   192
    []), ""), ""), []), ""), ""), ""), ""), ""),
walther@60044
   193
       []),
walther@60044
   194
      (("", ""), (((((((("", ""), ""), ""), ""), []),
walther@60044
   195
        ""), ""), [])))
walther@60044
   196
walther@60044
   197
type specification = (string * string) * model_refs_dummy
walther@60044
   198
val specification = (
walther@60152
   199
  (Parse.keyword_improper "Specification" -- Parse.$$$ ":") --
walther@60044
   200
    (Scan.optional
walther@60044
   201
      (model -- references)
walther@60044
   202
    )
walther@60044
   203
    model_refs_dummy
walther@60152
   204
    );
walther@60044
   205
walther@60087
   206
walther@60087
   207
(*** Solution ***)
walther@60087
   208
(** Tactics **)
walther@60044
   209
walther@60044
   210
val substitute = Parse.reserved "Substitute" -- Parse.term -- Parse.term;
walther@60044
   211
val rewrite_set_inst = Parse.reserved "Rewrite_Set_Inst" -- Parse.term -- Parse.name;
walther@60044
   212
val check_postcond = Parse.reserved "Check_Postcond" --
walther@60044
   213
  (Parse.$$$ "[" |-- Parse.list1 Parse.name --| Parse.$$$ "]");
walther@60044
   214
walther@60087
   215
(* see test/../Test_Parsers.thy || requires arguments of equal type *)
walther@60044
   216
fun exec_substitute ((str, tm), bdv) =
walther@60044
   217
  "EXEC IMMEDIATELY: " ^ str ^ " " ^ (*UnparseC.term*) tm ^ " " ^ (*UnparseC.term*) bdv;
walther@60044
   218
fun exec_rewrite_set_inst ((str, tm), id) =
walther@60044
   219
  "EXEC IMMEDIATELY: " ^ str ^ " " ^ (*UnparseC.term*) tm ^ " " ^ (*Problem.id_to_string*) id;
walther@60044
   220
fun exec_check_postcond (str, path) =
walther@60044
   221
  "EXEC IMMEDIATELY: " ^ str ^ " " ^ (*Problem.id_to_string*)fold (curry op ^) path "";
walther@60044
   222
walther@60044
   223
val tactic = ( (* incomplete list of tactics *)
walther@60044
   224
  Parse.$$$ "Tactic" --
walther@60044
   225
    (substitute >> exec_substitute ||
walther@60044
   226
     rewrite_set_inst >> exec_rewrite_set_inst ||
walther@60044
   227
     check_postcond >> exec_check_postcond
walther@60044
   228
    )
walther@60044
   229
  )
walther@60044
   230
walther@60087
   231
(** Step of term + tactic**)
walther@60044
   232
walther@60147
   233
val steps = (Scan.repeat (Parse.term -- (Scan.optional tactic ("", ""))))
walther@60147
   234
walther@60044
   235
fun exec_step_term (tm, (tac1, tac2)) =
walther@60044
   236
  "EXEC IMMEDIATELY step_term: " ^ (*UnparseC.term*) tm ^ " (" ^ tac1 ^ ", " ^ tac2 ^ ")";
walther@60147
   237
val steps_subpbl =
walther@60147
   238
  Scan.repeat (
walther@60147
   239
    ((Parse.term -- (Scan.optional tactic ("", ""))) >> exec_step_term) (** ) ||
walther@60147
   240
    (problem >> exec_subproblem) ( **)
walther@60147
   241
  )
walther@60044
   242
walther@60087
   243
(** Body **)
walther@60087
   244
walther@60087
   245
type body = (((((string * string) *
walther@60087
   246
  (((((((((((((((string * ((string * string) * string)) * string) * string) * string) * string list) * string) * string) * string list) * string) * string) * string) * string) * string) * string list) *
walther@60087
   247
    ((string * string) * ((((((((string * string) * string) * string) * string) * string list) * string) * string) * string list)))) *
walther@60087
   248
        string) * string) * string list)
walther@60087
   249
val body_dummy = ((((("", ""),
walther@60087
   250
  ((((((((((((((("", (("", ""), "")), ""), ""), ""), []), ""), ""), []), ""), ""), ""), ""), ""), []),
walther@60087
   251
    (("", ""), (((((((("", ""), ""), ""), ""), []), ""), ""), [])))),
walther@60087
   252
      ""), ""), [])
walther@60087
   253
val body =
walther@60087
   254
  specification --
walther@60087
   255
  Parse.$$$ "Solution" -- Parse.$$$ ":" --
walther@60087
   256
  (*/----- this will become "and steps".. *)
walther@60087
   257
    (Scan.repeat (
walther@60087
   258
      ((Parse.term -- (Scan.optional tactic ("", ""))) >> exec_step_term)  (** ) ||
walther@60087
   259
       (problem >> exec_subproblem)  ( *exec_* make types equal for both args of ||*)
walther@60087
   260
    ))
walther@60087
   261
  (*\----- ..this will become "and steps"
walther@60087
   262
    see Test_Parse_Isac subsubsection \<open>trials on recursion stopped\<close> *)
walther@60087
   263
walther@60087
   264
walther@60087
   265
(*** Problem ***)
walther@60128
   266
(* exclude "Problem" from parsing * )
walther@60087
   267
type problem =
walther@60087
   268
  (((((((string * string) * string) * string) * string list) * string) *
walther@60087
   269
    (((((string * string) *
walther@60087
   270
      (((((((((((((((string * ((string * string) * string)) * string) * string) * string) *
walther@60087
   271
        string list) * string) * string) * string list) * string) *
walther@60087
   272
        string) * string) * string) * string) * string list) *
walther@60087
   273
        ((string * string) *
walther@60087
   274
          ((((((((string * string) * string) * string) * string) * string list) * string) *
walther@60087
   275
            string) * string list)))) *
walther@60087
   276
      string) * string) * string list)) *
walther@60087
   277
    string)
walther@60128
   278
( * exclude "Problem" from parsing *)
walther@60128
   279
type problem =
walther@60128
   280
  (((((string * string) * string) * string list) * string) *
walther@60128
   281
    (((((string * string) *
walther@60128
   282
      (((((((((((((((string * ((string * string) * string)) * string) * string) * string) *
walther@60128
   283
        string list) * string) * string) * string list) * string) *
walther@60128
   284
        string) * string) * string) * string) * string list) *
walther@60128
   285
        ((string * string) *
walther@60128
   286
          ((((((((string * string) * string) * string) * string) * string list) * string)
walther@60128
   287
            * string) * string list)))) *
walther@60128
   288
      string) * string) * string list)) *
walther@60128
   289
    string
walther@60128
   290
(* exclude "Problem" from parsing *)
walther@60044
   291
val problem =
walther@60044
   292
  problem_headline --
walther@60087
   293
    (Scan.optional body) body_dummy --
walther@60087
   294
  (Scan.optional Parse.term) ""
walther@60044
   295
walther@60096
   296
walther@60096
   297
(**** parse Formalise ****)
walther@60096
   298
walther@60106
   299
(*** Tokenizer, from HOL/SPARK/Tools/fdl_lexer.ML ***)
walther@60097
   300
walther@60106
   301
val tokenize_string = Fdl_Lexer.$$$ "\"" |-- Fdl_Lexer.!!! "unclosed string" (*2*)
walther@60106
   302
  (Scan.repeat (Scan.unless (Fdl_Lexer.$$$ "\"") Fdl_Lexer.any) --| Fdl_Lexer.$$$ "\"") >>
walther@60106
   303
    Fdl_Lexer.make_token Fdl_Lexer.Comment(*!!!*);
walther@60097
   304
walther@60106
   305
val scan =
walther@60106
   306
  Scan.repeat (Scan.unless (Scan.one Fdl_Lexer.is_char_eof)
walther@60106
   307
    (Fdl_Lexer.!!! "bad input"
walther@60106
   308
       (   tokenize_string           (*.. this must be first *)
walther@60106
   309
        ||Scan.max Fdl_Lexer.leq_token
walther@60106
   310
             (Scan.literal Fdl_Lexer.lexicon >> Fdl_Lexer.make_token Fdl_Lexer.Keyword)
walther@60106
   311
             (   Fdl_Lexer.long_identifier >> Fdl_Lexer.make_token Fdl_Lexer.Long_Ident
walther@60106
   312
              || Fdl_Lexer.identifier >> Fdl_Lexer.make_token Fdl_Lexer.Ident)
walther@60106
   313
       ) --|
walther@60106
   314
     Fdl_Lexer.whitespace) );
walther@60096
   315
walther@60132
   316
fun tokenize_formalise pos str =
walther@60106
   317
  (Scan.finite Fdl_Lexer.char_stopper
walther@60106
   318
    (Scan.error scan) (Fdl_Lexer.explode_pos str pos));
walther@60096
   319
walther@60106
   320
walther@60106
   321
(*** the parser from HOL/SPARK/Tools/fdl_parser.ML ***)
walther@60106
   322
walther@60106
   323
type form_model = TermC.as_string list;
walther@60106
   324
type form_refs = (((((string * string) * string) * string list) * string) * string list) * string
walther@60106
   325
type form_model_refs = ((((((string * string) * form_model) * string) *
walther@60154
   326
  ((((((string * ThyC.id) * string) * Problem.id) * string) * MethodC.id) * string)) * 
walther@60106
   327
    string) * string)
walther@60106
   328
type formalise = (((((string * string) * form_model) * string) *
walther@60154
   329
  ((((((string * ThyC.id) * string) * Problem.id) * string) * MethodC.id) * string)) *
walther@60106
   330
    string) * string;
walther@60106
   331
walther@60106
   332
val parse_string = Fdl_Parser.group "string"
walther@60106
   333
  (Scan.one (fn t => Fdl_Lexer.kind_of t = Fdl_Lexer.Comment) >>
walther@60106
   334
     Fdl_Lexer.content_of);
walther@60106
   335
walther@60106
   336
val parse_form_model =
walther@60106
   337
  (Fdl_Parser.$$$ "[" |-- Fdl_Parser.!!! (
walther@60106
   338
    Fdl_Parser.list1 parse_string --| 
walther@60106
   339
  Fdl_Parser.$$$ "]"));
walther@60106
   340
walther@60106
   341
val parse_form_refs = 
walther@60106
   342
  Fdl_Parser.$$$ "(" --
walther@60106
   343
    parse_string --                     (* "Biegelinie" *)
walther@60106
   344
  Fdl_Parser.$$$ "," --
walther@60106
   345
    (Fdl_Parser.$$$ "[" |-- Fdl_Parser.!!! (
walther@60106
   346
      Fdl_Parser.list1 parse_string --| (* ["Biegelinien"] *)
walther@60106
   347
    Fdl_Parser.$$$ "]")) --
walther@60106
   348
  Fdl_Parser.$$$ "," --
walther@60106
   349
    (Fdl_Parser.$$$ "[" |-- Fdl_Parser.!!! (
walther@60106
   350
      Fdl_Parser.list1 parse_string --| (* ["IntegrierenUndKonstanteBestimmen2"] *)
walther@60106
   351
    Fdl_Parser.$$$ "]")) --
walther@60106
   352
  Fdl_Parser.$$$ ")";
walther@60106
   353
walther@60106
   354
(*val parse_formalise =   KEEP IDENTIFIERS CLOSE TO SPARK..*)
walther@60122
   355
val formalisation =
walther@60106
   356
  Fdl_Parser.!!! (
walther@60106
   357
    Fdl_Parser.$$$ "[" --
walther@60106
   358
      Fdl_Parser.$$$ "(" --
walther@60106
   359
        parse_form_model --
walther@60106
   360
      Fdl_Parser.$$$ "," --
walther@60106
   361
        parse_form_refs --
walther@60106
   362
      Fdl_Parser.$$$ ")" --
walther@60106
   363
    Fdl_Parser.$$$ "]");
walther@60106
   364
walther@60106
   365
fun read_out_formalise ((((( (
walther@60106
   366
  "[", 
walther@60106
   367
    "("),
walther@60106
   368
      form_model: TermC.as_string list),
walther@60106
   369
    ","), ((((((
walther@60106
   370
      "(", 
walther@60106
   371
        thy_id: ThyC.id), 
walther@60106
   372
      ","), 
walther@60106
   373
        probl_id: Problem.id), 
walther@60106
   374
      ","), 
walther@60154
   375
        meth_id: MethodC.id), 
walther@60106
   376
      ")")),
walther@60106
   377
    ")"),
walther@60106
   378
  "]") = [(form_model, (thy_id, probl_id, meth_id))]
walther@60106
   379
| read_out_formalise _ =
walther@60106
   380
  raise ERROR "read_out_formalise: WRONGLY parsed";
walther@60096
   381
walther@60087
   382
(**)end(*struct*)