doc-src/IsarRef/Thy/Inner_Syntax.thy
changeset 28777 2eeeced17228
parent 28774 0e25ef17b06b
child 28778 a25630deacaf
equal deleted inserted replaced
28776:e4090e51b8b9 28777:2eeeced17228
   389   \end{description}
   389   \end{description}
   390 *}
   390 *}
   391 
   391 
   392 section {* The Pure syntax *}
   392 section {* The Pure syntax *}
   393 
   393 
   394 subsection {* Priority grammars *}
   394 subsection {* Priority grammars \label{sec:priority-grammar} *}
   395 
   395 
   396 text {* A context-free grammar consists of a set of \emph{terminal
   396 text {* A context-free grammar consists of a set of \emph{terminal
   397   symbols}, a set of \emph{nonterminal symbols} and a set of
   397   symbols}, a set of \emph{nonterminal symbols} and a set of
   398   \emph{productions}.  Productions have the form @{text "A = \<gamma>"},
   398   \emph{productions}.  Productions have the form @{text "A = \<gamma>"},
   399   where @{text A} is a nonterminal and @{text \<gamma>} is a string of
   399   where @{text A} is a nonterminal and @{text \<gamma>} is a string of
   641   calculational reasoning (\secref{sec:calculation}).
   641   calculational reasoning (\secref{sec:calculation}).
   642 
   642 
   643   \end{itemize}
   643   \end{itemize}
   644 *}
   644 *}
   645 
   645 
       
   646 
   646 section {* Lexical matters \label{sec:inner-lex} *}
   647 section {* Lexical matters \label{sec:inner-lex} *}
   647 
   648 
   648 text FIXME
   649 text {* The inner lexical syntax vaguely resembles the outer one
       
   650   (\secref{sec:outer-lex}), but some details are different.  There are
       
   651   two main categories of inner syntax tokens:
       
   652 
       
   653   \begin{enumerate}
       
   654 
       
   655   \item \emph{delimiters} --- the literal tokens occurring in
       
   656   productions of the given priority grammar (cf.\
       
   657   \secref{sec:priority-grammar});
       
   658 
       
   659   \item \emph{named tokens} --- various categories of identifiers etc.
       
   660 
       
   661   \end{enumerate}
       
   662 
       
   663   Delimiters override named tokens and may thus render certain
       
   664   identifiers inaccessible.  Sometimes the logical context admits
       
   665   alternative ways to refer to the same entity, potentially via
       
   666   qualified names.
       
   667 
       
   668   \medskip The categories for named tokens are defined once and for
       
   669   all as follows, reusing some categories of the outer token syntax
       
   670   (\secref{sec:outer-lex}).
       
   671 
       
   672   \begin{center}
       
   673   \begin{supertabular}{rcl}
       
   674     @{syntax_def (inner) id} & = & @{syntax_ref ident} \\
       
   675     @{syntax_def (inner) longid} & = & @{syntax_ref longident} \\
       
   676     @{syntax_def (inner) var} & = & @{syntax_ref var} \\
       
   677     @{syntax_def (inner) tid} & = & @{syntax_ref typefree} \\
       
   678     @{syntax_def (inner) tvar} & = & @{syntax_ref typevar} \\
       
   679     @{syntax_def (inner) num} & = & @{syntax_ref nat}@{text "  |  "}@{verbatim "-"}@{syntax_ref nat} \\
       
   680     @{syntax_def (inner) xnum} & = & @{verbatim "#"}@{syntax_ref nat}@{text "  |  "}@{verbatim "#-"}@{syntax_ref nat} \\
       
   681 
       
   682     @{syntax_def (inner) xstr} & = & @{verbatim "''"} @{text "\<dots>"} @{verbatim "''"} \\
       
   683   \end{supertabular}
       
   684   \end{center}
       
   685 
       
   686   The token categories @{syntax_ref (inner) num}, @{syntax_ref (inner)
       
   687   xnum}, and @{syntax_ref (inner) xstr} are not used in Pure.
       
   688   Object-logics may implement numerals and string constants by adding
       
   689   appropriate syntax declarations, together with some translation
       
   690   functions (e.g.\ see Isabelle/HOL).
       
   691 *}
   649 
   692 
   650 
   693 
   651 section {* Syntax and translations \label{sec:syn-trans} *}
   694 section {* Syntax and translations \label{sec:syn-trans} *}
   652 
   695 
   653 text {*
   696 text {*