Theory ML_Unification.ML_Parsing_Utils
section ‹ML Parsing Utils›
theory ML_Parsing_Utils
imports
ML_Attributes
ML_Attribute_Utils
begin
paragraph ‹Summary›
text ‹Parsing utilities for ML. We provide an antiquotation that takes a list of
keys and creates a corresponding record with getters and mappers and a parser for corresponding
key-value pairs.›
ML_file‹parse_util.ML›
ML_file‹parse_key_value.ML›
ML_file‹parse_key_value_antiquot.ML›
paragraph ‹Example›
ML_command‹
@{parse_entries (struct) Test [ABC, DEFG]}
val parser =
let
val parse_entry = Parse_Key_Value.parse_entry
Test.parse_key
(Scan.succeed [])
(Test.parse_entry
Parse.string
Parse.int)
val required_keys = [Test.key Test.ABC]
val default_entries = Test.empty_entries ()
in Test.parse_entries_required Parse.and_list1 required_keys parse_entry default_entries end
›
end