doc-src/IsarRef/Thy/Inner_Syntax.thy
changeset 46291 a1827b8b45ae
parent 46290 465851ba524e
child 46292 4eb48958b50f
equal deleted inserted replaced
46290:465851ba524e 46291:a1827b8b45ae
   972 
   972 
   973   \end{description}
   973   \end{description}
   974 *}
   974 *}
   975 
   975 
   976 
   976 
       
   977 subsection {* Ambiguity of parsed expressions *}
       
   978 
       
   979 text {*
       
   980   \begin{tabular}{rcll}
       
   981     @{attribute_def syntax_ambiguity_level} & : & @{text attribute} & default @{text 1} \\
       
   982   \end{tabular}
       
   983 
       
   984   \begin{mldecls}
       
   985     @{index_ML Syntax.ambiguity_limit: "int Config.T"} \\  %FIXME attribute
       
   986   \end{mldecls}
       
   987 
       
   988   Depending on the grammar and the given input, parsing may be
       
   989   ambiguous.  Isabelle lets the Earley parser enumerate all possible
       
   990   parse trees, and then tries to make the best out of the situation.
       
   991   Terms that cannot be type-checked are filtered out, which often
       
   992   leads to a unique result in the end.  Unlike regular type
       
   993   reconstruction, which is applied to the whole collection of input
       
   994   terms simultaneously, the filtering stage only treats each given
       
   995   term in isolation.  Filtering is also not attempted for individual
       
   996   types or raw ASTs (as required for @{command translations}).
       
   997 
       
   998   Certain warning or error messages are printed, depending on the
       
   999   situation and the given configuration options.  Parsing ultimately
       
  1000   fails, if multiple results remain after the filtering phase.
       
  1001 
       
  1002   \begin{description}
       
  1003 
       
  1004   \item @{attribute syntax_ambiguity_level} determines the number of
       
  1005   parser results that are tolerated without printing a detailed
       
  1006   message.
       
  1007 
       
  1008   \item @{ML Syntax.ambiguity_limit} determines the number of
       
  1009   resulting parse trees that are shown as part of the printed message
       
  1010   in case of an ambiguity.
       
  1011 
       
  1012   \end{description}
       
  1013 *}
       
  1014 
       
  1015 
   977 section {* Raw syntax and translations \label{sec:syn-trans} *}
  1016 section {* Raw syntax and translations \label{sec:syn-trans} *}
   978 
  1017 
   979 text {*
  1018 text {*
   980   \begin{matharray}{rcl}
  1019   \begin{matharray}{rcl}
   981     @{command_def "nonterminal"} & : & @{text "theory \<rightarrow> theory"} \\
  1020     @{command_def "nonterminal"} & : & @{text "theory \<rightarrow> theory"} \\