Function programinduction::trs::parser::parse_lexicon
source · pub fn parse_lexicon(
lexicon: &str,
background: &str,
templates: &str,
deterministic: bool,
ctx: Context
) -> Result<Lexicon, ParseError>
Expand description
Parse a Lexicon
, including its background
knowledge, and any templates
that might be used during learning, ensuring that background
and
templates
typecheck according to the types in the newly instantiated
Lexicon
. Syntax errors and failed typechecking both lead to Err
.
Lexicon syntax
input
is parsed as a lexicon
, defined below in augmented Backus-Naur
form. The definition of scheme
is as given in polytype
, while other
terms are as given in term_rewriting
:
lexicon = *wsp *( *comment declaration ";" *comment ) *wsp
declaration = *wsp identifier *wsp ":" *wsp scheme *wsp
Background syntax
background
is parsed as a rule_list
, defined below in augmented Backus-Naur form.
The format of the other terms is as given in term_rewriting
:
rule_list = *wsp *( *comment rule ";" *comment ) *wsp
Template Syntax
templates
is parsed as a rulecontext_list
, defined below in augmented Backus-Naur form.
The format of the other terms is as given in term_rewriting
:
rulecontext_list = *wsp *( *comment rulecontext ";" *comment ) *wsp