src/Doc/IsarRef/Inner_Syntax.thy
changeset 51654 8450b944e58a
parent 50636 07f47142378e
child 51657 3db1bbc82d8d
equal deleted inserted replaced
51653:97de25c51b2d 51654:8450b944e58a
   360   Isabelle mixfix syntax is inspired by {\OBJ} \cite{OBJ}.  It allows
   360   Isabelle mixfix syntax is inspired by {\OBJ} \cite{OBJ}.  It allows
   361   to specify any context-free priority grammar, which is more general
   361   to specify any context-free priority grammar, which is more general
   362   than the fixity declarations of ML and Prolog.
   362   than the fixity declarations of ML and Prolog.
   363 
   363 
   364   @{rail "
   364   @{rail "
   365     @{syntax_def mixfix}: '(' mfix ')'
   365     @{syntax_def mixfix}: '('
   366     ;
   366       @{syntax template} prios? @{syntax nat}? |
   367     @{syntax_def struct_mixfix}: '(' ( mfix | @'structure' ) ')'
       
   368     ;
       
   369 
       
   370     mfix: @{syntax template} prios? @{syntax nat}? |
       
   371       (@'infix' | @'infixl' | @'infixr') @{syntax template} @{syntax nat} |
   367       (@'infix' | @'infixl' | @'infixr') @{syntax template} @{syntax nat} |
   372       @'binder' @{syntax template} prios? @{syntax nat}
   368       @'binder' @{syntax template} prios? @{syntax nat} |
       
   369       @'structure'
       
   370     ')'
   373     ;
   371     ;
   374     template: string
   372     template: string
   375     ;
   373     ;
   376     prios: '[' (@{syntax nat} + ',') ']'
   374     prios: '[' (@{syntax nat} + ',') ']'
   377   "}
   375   "}
   378 
   376 
   379   The string given as @{text template} may include literal text,
   377   The string given as @{text template} may include literal text,
   380   spacing, blocks, and arguments (denoted by ``@{text _}''); the
   378   spacing, blocks, and arguments (denoted by ``@{text _}''); the
   381   special symbol ``@{verbatim "\<index>"}'' (printed as ``@{text "\<index>"}'')
   379   special symbol ``@{verbatim "\<index>"}'' (printed as ``@{text "\<index>"}'')
   382   represents an index argument that specifies an implicit structure
   380   represents an index argument that specifies an implicit
   383   reference (see also \secref{sec:locale}).  Infix and binder
   381   @{text "\<STRUCTURE>"} reference (see also \secref{sec:locale}).  Infix and
   384   declarations provide common abbreviations for particular mixfix
   382   binder declarations provide common abbreviations for particular mixfix
   385   declarations.  So in practice, mixfix templates mostly degenerate to
   383   declarations.  So in practice, mixfix templates mostly degenerate to
   386   literal text for concrete syntax, such as ``@{verbatim "++"}'' for
   384   literal text for concrete syntax, such as ``@{verbatim "++"}'' for
   387   an infix symbol.
   385   an infix symbol.
   388 *}
   386 *}
   389 
   387 
   566   @{rail "
   564   @{rail "
   567     (@@{command type_notation} | @@{command no_type_notation}) @{syntax target}?
   565     (@@{command type_notation} | @@{command no_type_notation}) @{syntax target}?
   568       @{syntax mode}? \\ (@{syntax nameref} @{syntax mixfix} + @'and')
   566       @{syntax mode}? \\ (@{syntax nameref} @{syntax mixfix} + @'and')
   569     ;
   567     ;
   570     (@@{command notation} | @@{command no_notation}) @{syntax target}? @{syntax mode}? \\
   568     (@@{command notation} | @@{command no_notation}) @{syntax target}? @{syntax mode}? \\
   571       (@{syntax nameref} @{syntax struct_mixfix} + @'and')
   569       (@{syntax nameref} @{syntax mixfix} + @'and')
   572     ;
   570     ;
   573     @@{command write} @{syntax mode}? (@{syntax nameref} @{syntax struct_mixfix} + @'and')
   571     @@{command write} @{syntax mode}? (@{syntax nameref} @{syntax mixfix} + @'and')
   574   "}
   572   "}
   575 
   573 
   576   \begin{description}
   574   \begin{description}
   577 
   575 
   578   \item @{command "type_notation"}~@{text "c (mx)"} associates mixfix
   576   \item @{command "type_notation"}~@{text "c (mx)"} associates mixfix