410 \isamarkuptrue% |
410 \isamarkuptrue% |
411 % |
411 % |
412 \begin{isamarkuptext}% |
412 \begin{isamarkuptext}% |
413 Mixfix annotations specify concrete \emph{inner syntax} of |
413 Mixfix annotations specify concrete \emph{inner syntax} of |
414 Isabelle types and terms. Locally fixed parameters in toplevel |
414 Isabelle types and terms. Locally fixed parameters in toplevel |
415 theorem statements, locale specifications etc.\ also admit mixfix |
415 theorem statements, locale and class specifications also admit |
416 annotations. |
416 mixfix annotations in a fairly uniform manner. A mixfix annotation |
|
417 describes describes the concrete syntax, the translation to abstract |
|
418 syntax, and the pretty printing. Special case annotations provide a |
|
419 simple means of specifying infix operators and binders. |
|
420 |
|
421 Isabelle mixfix syntax is inspired by {\OBJ} \cite{OBJ}. It allows |
|
422 to specify any context-free priority grammar, which is more general |
|
423 than the fixity declarations of ML and Prolog. |
417 |
424 |
418 \begin{railoutput} |
425 \begin{railoutput} |
419 \rail@begin{1}{\indexdef{}{syntax}{mixfix}\hypertarget{syntax.mixfix}{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}} |
426 \rail@begin{1}{\indexdef{}{syntax}{mixfix}\hypertarget{syntax.mixfix}{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}} |
420 \rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[] |
427 \rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[] |
421 \rail@nont{\isa{mfix}}[] |
428 \rail@nont{\isa{mfix}}[] |
447 \rail@nextbar{3} |
454 \rail@nextbar{3} |
448 \rail@term{\isa{\isakeyword{infixl}}}[] |
455 \rail@term{\isa{\isakeyword{infixl}}}[] |
449 \rail@nextbar{4} |
456 \rail@nextbar{4} |
450 \rail@term{\isa{\isakeyword{infixr}}}[] |
457 \rail@term{\isa{\isakeyword{infixr}}}[] |
451 \rail@endbar |
458 \rail@endbar |
452 \rail@nont{\hyperlink{syntax.string}{\mbox{\isa{string}}}}[] |
459 \rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[] |
453 \rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[] |
460 \rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[] |
454 \rail@nextbar{5} |
461 \rail@nextbar{5} |
455 \rail@term{\isa{\isakeyword{binder}}}[] |
462 \rail@term{\isa{\isakeyword{binder}}}[] |
456 \rail@nont{\hyperlink{syntax.string}{\mbox{\isa{string}}}}[] |
463 \rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[] |
457 \rail@bar |
464 \rail@bar |
458 \rail@nextbar{6} |
465 \rail@nextbar{6} |
459 \rail@nont{\isa{prios}}[] |
466 \rail@nont{\isa{prios}}[] |
460 \rail@endbar |
467 \rail@endbar |
461 \rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[] |
468 \rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[] |
462 \rail@endbar |
469 \rail@endbar |
|
470 \rail@end |
|
471 \rail@begin{1}{\isa{template}} |
|
472 \rail@nont{\isa{string}}[] |
463 \rail@end |
473 \rail@end |
464 \rail@begin{2}{\isa{prios}} |
474 \rail@begin{2}{\isa{prios}} |
465 \rail@term{\isa{{\isaliteral{5B}{\isacharbrackleft}}}}[] |
475 \rail@term{\isa{{\isaliteral{5B}{\isacharbrackleft}}}}[] |
466 \rail@plus |
476 \rail@plus |
467 \rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[] |
477 \rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[] |
471 \rail@term{\isa{{\isaliteral{5D}{\isacharbrackright}}}}[] |
481 \rail@term{\isa{{\isaliteral{5D}{\isacharbrackright}}}}[] |
472 \rail@end |
482 \rail@end |
473 \end{railoutput} |
483 \end{railoutput} |
474 |
484 |
475 |
485 |
476 Here the \hyperlink{syntax.string}{\mbox{\isa{string}}} specifications refer to the actual mixfix |
486 The string given as \isa{template} may include literal text, |
477 template, which may include literal text, spacing, blocks, and |
487 spacing, blocks, and arguments (denoted by ``\isa{{\isaliteral{5F}{\isacharunderscore}}}''); the |
478 arguments (denoted by ``\isa{{\isaliteral{5F}{\isacharunderscore}}}''); the special symbol |
488 special symbol ``\verb|\<index>|'' (printed as ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}}'') |
479 ``\verb|\<index>|'' (printed as ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}}'') represents an index |
489 represents an index argument that specifies an implicit structure |
480 argument that specifies an implicit structure reference (see also |
490 reference (see also \secref{sec:locale}). Infix and binder |
481 \secref{sec:locale}). Infix and binder declarations provide common |
491 declarations provide common abbreviations for particular mixfix |
482 abbreviations for particular mixfix declarations. So in practice, |
492 declarations. So in practice, mixfix templates mostly degenerate to |
483 mixfix templates mostly degenerate to literal text for concrete |
493 literal text for concrete syntax, such as ``\verb|++|'' for |
484 syntax, such as ``\verb|++|'' for an infix symbol. |
494 an infix symbol.% |
485 |
495 \end{isamarkuptext}% |
486 \medskip In full generality, mixfix declarations work as follows. |
496 \isamarkuptrue% |
487 Suppose a constant \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} is |
497 % |
488 annotated by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}mixfix\ {\isaliteral{5B}{\isacharbrackleft}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ p\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{5D}{\isacharbrackright}}\ p{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, where \isa{{\isaliteral{22}{\isachardoublequote}}mixfix{\isaliteral{22}{\isachardoublequote}}} is a string \isa{{\isaliteral{22}{\isachardoublequote}}d\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{0}}\ {\isaliteral{5F}{\isacharunderscore}}\ d\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5F}{\isacharunderscore}}\ d\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} consisting of |
498 \isamarkupsubsection{The general mixfix form% |
489 delimiters that surround argument positions as indicated by |
499 } |
490 underscores. |
500 \isamarkuptrue% |
|
501 % |
|
502 \begin{isamarkuptext}% |
|
503 In full generality, mixfix declarations work as follows. |
|
504 Suppose a constant \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} is annotated by |
|
505 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}mixfix\ {\isaliteral{5B}{\isacharbrackleft}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ p\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{5D}{\isacharbrackright}}\ p{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, where \isa{{\isaliteral{22}{\isachardoublequote}}mixfix{\isaliteral{22}{\isachardoublequote}}} is a string |
|
506 \isa{{\isaliteral{22}{\isachardoublequote}}d\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{0}}\ {\isaliteral{5F}{\isacharunderscore}}\ d\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5F}{\isacharunderscore}}\ d\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} consisting of delimiters that surround |
|
507 argument positions as indicated by underscores. |
491 |
508 |
492 Altogether this determines a production for a context-free priority |
509 Altogether this determines a production for a context-free priority |
493 grammar, where for each argument \isa{{\isaliteral{22}{\isachardoublequote}}i{\isaliteral{22}{\isachardoublequote}}} the syntactic category |
510 grammar, where for each argument \isa{{\isaliteral{22}{\isachardoublequote}}i{\isaliteral{22}{\isachardoublequote}}} the syntactic category |
494 is determined by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} (with priority \isa{{\isaliteral{22}{\isachardoublequote}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}}), and |
511 is determined by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} (with priority \isa{{\isaliteral{22}{\isachardoublequote}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}}), and |
495 the result category is determined from \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} (with |
512 the result category is determined from \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} (with |
556 stands for the string of spaces (zero or more) right after the |
573 stands for the string of spaces (zero or more) right after the |
557 slash. These spaces are printed if the break is \emph{not} taken. |
574 slash. These spaces are printed if the break is \emph{not} taken. |
558 |
575 |
559 \end{description} |
576 \end{description} |
560 |
577 |
561 For example, the template \verb|(_ +/ _)| specifies an infix |
|
562 operator. There are two argument positions; the delimiter |
|
563 \verb|+| is preceded by a space and followed by a space or |
|
564 line break; the entire phrase is a pretty printing block. |
|
565 |
|
566 The general idea of pretty printing with blocks and breaks is also |
578 The general idea of pretty printing with blocks and breaks is also |
567 described in \cite{paulson-ml2}; it goes back to \cite{Oppen:1980}.% |
579 described in \cite{paulson-ml2}; it goes back to \cite{Oppen:1980}.% |
|
580 \end{isamarkuptext}% |
|
581 \isamarkuptrue% |
|
582 % |
|
583 \isamarkupsubsection{Infixes% |
|
584 } |
|
585 \isamarkuptrue% |
|
586 % |
|
587 \begin{isamarkuptext}% |
|
588 Infix operators are specified by convenient short forms that |
|
589 abbreviate general mixfix annotations as follows: |
|
590 |
|
591 \begin{center} |
|
592 \begin{tabular}{lll} |
|
593 |
|
594 \verb|(|\hyperlink{keyword.infix}{\mbox{\isa{\isakeyword{infix}}}}~\verb|"|\isa{sy}\verb|"| \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|)| |
|
595 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} & |
|
596 \verb|("(_ |\isa{sy}\verb|/ _)" [|\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|, |\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|]|\isa{{\isaliteral{22}{\isachardoublequote}}\ p{\isaliteral{22}{\isachardoublequote}}}\verb|)| \\ |
|
597 \verb|(|\hyperlink{keyword.infixl}{\mbox{\isa{\isakeyword{infixl}}}}~\verb|"|\isa{sy}\verb|"| \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|)| |
|
598 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} & |
|
599 \verb|("(_ |\isa{sy}\verb|/ _)" [|\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|, |\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|]|\isa{{\isaliteral{22}{\isachardoublequote}}\ p{\isaliteral{22}{\isachardoublequote}}}\verb|)| \\ |
|
600 \verb|(|\hyperlink{keyword.infixr}{\mbox{\isa{\isakeyword{infixr}}}}~\verb|"|\isa{sy}\verb|"| \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|)| |
|
601 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} & |
|
602 \verb|("(_ |\isa{sy}\verb|/ _)" [|\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|, |\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|]|\isa{{\isaliteral{22}{\isachardoublequote}}\ p{\isaliteral{22}{\isachardoublequote}}}\verb|)| \\ |
|
603 |
|
604 \end{tabular} |
|
605 \end{center} |
|
606 |
|
607 The mixfix template \verb|"(_ |\isa{sy}\verb|/|\isasep\isanewline% |
|
608 \verb| _)"| specifies two argument positions; the delimiter is preceded |
|
609 by a space and followed by a space or line break; the entire phrase |
|
610 is a pretty printing block. |
|
611 |
|
612 The alternative notation \verb|op|~\isa{sy} is introduced |
|
613 in addition. Thus any infix operator may be written in prefix form |
|
614 (as in ML), independently of the number of arguments in the term.% |
|
615 \end{isamarkuptext}% |
|
616 \isamarkuptrue% |
|
617 % |
|
618 \isamarkupsubsection{Binders% |
|
619 } |
|
620 \isamarkuptrue% |
|
621 % |
|
622 \begin{isamarkuptext}% |
|
623 A \emph{binder} is a variable-binding construct such as a |
|
624 quantifier. The idea to formalize \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{22}{\isachardoublequote}}} as \isa{{\isaliteral{22}{\isachardoublequote}}All\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} for \isa{{\isaliteral{22}{\isachardoublequote}}All\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequote}}} already goes back |
|
625 to \cite{church40}. Isabelle declarations of certain higher-order |
|
626 operators may be annotated with \hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}} annotations as |
|
627 follows: |
|
628 |
|
629 \begin{center} |
|
630 \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}}\verb|"|\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{3}}{\isaliteral{22}{\isachardoublequote}}}\verb|" (|\hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}}\verb| "|\isa{{\isaliteral{22}{\isachardoublequote}}sy{\isaliteral{22}{\isachardoublequote}}}\verb|" [|\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|] |\isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}\verb|)| |
|
631 \end{center} |
|
632 |
|
633 This introduces concrete binder syntax \isa{{\isaliteral{22}{\isachardoublequote}}sy\ x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{22}{\isachardoublequote}}}, where |
|
634 \isa{x} is a bound variable of type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}, the body \isa{b} has type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} and the whole term has type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{3}}{\isaliteral{22}{\isachardoublequote}}}. |
|
635 The optional integer \isa{p} specifies the syntactic priority of |
|
636 the body; the default is \isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}, which is also the priority of |
|
637 the whole construct. |
|
638 |
|
639 Internally, the binder syntax is expanded to something like this: |
|
640 \begin{center} |
|
641 \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{5F}{\isacharunderscore}}binder\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}}\verb|"|\isa{{\isaliteral{22}{\isachardoublequote}}idts\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{3}}{\isaliteral{22}{\isachardoublequote}}}\verb|" ("(3|\isa{sy}\verb|_./ _)" [0, |\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|] |\isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}\verb|)| |
|
642 \end{center} |
|
643 |
|
644 Here \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}} is the nonterminal symbol for a list of |
|
645 identifiers with optional type constraints (see also |
|
646 \secref{sec:pure-grammar}). The mixfix template \verb|"(3|\isa{sy}\verb|_./ _)"| defines argument positions |
|
647 for the bound identifiers and the body, separated by a dot with |
|
648 optional line break; the entire phrase is a pretty printing block of |
|
649 indentation level 3. Note that there is no extra space after \isa{{\isaliteral{22}{\isachardoublequote}}sy{\isaliteral{22}{\isachardoublequote}}}, so it needs to be included user specification if the binder |
|
650 syntax ends with a token that may be continued by an identifier |
|
651 token at the start of \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}. |
|
652 |
|
653 Furthermore, a syntax translation to transforms \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{5F}{\isacharunderscore}}binder\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ b{\isaliteral{22}{\isachardoublequote}}} into iterated application \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ c\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}. |
|
654 This works in both directions, for parsing and printing.% |
568 \end{isamarkuptext}% |
655 \end{isamarkuptext}% |
569 \isamarkuptrue% |
656 \isamarkuptrue% |
570 % |
657 % |
571 \isamarkupsection{Explicit notation \label{sec:notation}% |
658 \isamarkupsection{Explicit notation \label{sec:notation}% |
572 } |
659 } |