# HG changeset patch # User wenzelm # Date 1724670934 -7200 # Node ID 83d21da2bc594e0ab7f4290e479e7a343f0a956e # Parent 39641d8bd4229dfdc075a31ae5bba45d18d8c596 NEWS and documentation; diff -r 39641d8bd422 -r 83d21da2bc59 NEWS --- a/NEWS Sun Aug 25 23:19:33 2024 +0200 +++ b/NEWS Mon Aug 26 13:15:34 2024 +0200 @@ -9,6 +9,13 @@ ** General ** +* Inner syntax translations now support formal dependencies via commands +'syntax_types' or 'syntax_consts'. This is essentially an abstract +specification of the effect of 'translations' (or translation functions +in ML). Most Isabelle theories have been adapted accordingly, such that +hyperlinks work properly e.g. for "['a, 'b] \ 'c" or "\A; B\ \ C" in +Pure, and "\x\A. B x" or "\x\A. B x" in HOL. + * The Simplifier now supports special "congprocs", using keyword 'congproc' or 'weak_congproc' in the 'simproc_setup' command (or ML antiquotation of the same name). See also diff -r 39641d8bd422 -r 83d21da2bc59 src/Doc/Isar_Ref/Inner_Syntax.thy --- a/src/Doc/Isar_Ref/Inner_Syntax.thy Sun Aug 25 23:19:33 2024 +0200 +++ b/src/Doc/Isar_Ref/Inner_Syntax.thy Mon Aug 26 13:15:34 2024 +0200 @@ -1078,6 +1078,8 @@ @{command_def "nonterminal"} & : & \theory \ theory\ \\ @{command_def "syntax"} & : & \local_theory \ local_theory\ \\ @{command_def "no_syntax"} & : & \local_theory \ local_theory\ \\ + @{command_def "syntax_types"} & : & \theory \ theory\ \\ + @{command_def "syntax_consts"} & : & \theory \ theory\ \\ @{command_def "translations"} & : & \theory \ theory\ \\ @{command_def "no_translations"} & : & \theory \ theory\ \\ @{attribute_def syntax_ast_trace} & : & \attribute\ & default \false\ \\ @@ -1089,8 +1091,9 @@ raw syntax declarations provide full access to the priority grammar of the inner syntax, without any sanity checks. This includes additional syntactic categories (via @{command nonterminal}) and free-form grammar productions - (via @{command syntax}). Additional syntax translations (or macros, via - @{command translations}) are required to turn resulting parse trees into + (via @{command syntax} with formal dependencies via @{command syntax_types} + and @{command syntax_consts}). Additional syntax translations (or macros, + via @{command translations}) are required to turn resulting parse trees into proper representations of formal entities again. \<^rail>\ @@ -1098,6 +1101,8 @@ ; (@@{command syntax} | @@{command no_syntax}) @{syntax mode}? (constdecl +) ; + (@@{command syntax_types} | @@{command syntax_consts}) (syntaxdeps + @'and') + ; (@@{command translations} | @@{command no_translations}) (transpat ('==' | '=>' | '<=' | '\' | '\' | '\') transpat +) ; @@ -1106,6 +1111,8 @@ ; mode: ('(' ( @{syntax name} | @'output' | @{syntax name} @'output' ) ')') ; + syntaxdeps: (@{syntax name}+) ('==' | '\') (@{syntax name}+) + ; transpat: ('(' @{syntax name} ')')? @{syntax string} \ @@ -1157,6 +1164,14 @@ translations) resulting from \decls\, which are interpreted in the same manner as for @{command "syntax"} above. + \<^descr> @{command "syntax_types"}~\syntax \ types\ and @{command + "syntax_consts"}~\syntax \ consts\ declare dependencies of syntax constants + wrt.\ formal entities of the logic: multiple names may be given on both + sides. This tells the inner-syntax engine how to markup concrete syntax, to + support hyperlinks in the browser or editor. It is essentially an abstract + specification of the effect of translation rules (see below) or translation + functions (see \secref{sec:tr-funs}). + \<^descr> @{command "translations"}~\rules\ specifies syntactic translation rules (i.e.\ macros) as first-order rewrite rules on ASTs (\secref{sec:ast}). The theory context maintains two independent lists translation rules: parse