Skip to content

Commit

Permalink
Use table to present extended BNF
Browse files Browse the repository at this point in the history
This is similar to how we present string escape sequences, with good formatting of the textual descriptions.
  • Loading branch information
henrikt-ma committed Feb 10, 2021
1 parent 972f164 commit 246bab1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions chapters/syntax.tex
Expand Up @@ -2,12 +2,19 @@ \chapter{Modelica Concrete Syntax}\label{modelica-concrete-syntax}
\section{Lexical conventions}\label{lexical-conventions}

The following syntactic meta symbols are used (extended BNF):
\begin{lstlisting}[language=grammar]
[ ] optional
{ } repeat zero or more times
| or
"text" The text is treated as a single token (no white-space between any characters)
\end{lstlisting}
\begin{center}
\begin{tabular}{c l}
\hline
\tablehead{Syntax} & \tablehead{Description}\\
\hline
\hline
\lstinline[language=grammar]![ $\ldots$ ]! & Optional\\
\lstinline[language=grammar]!{ $\ldots$ }! & Repeat zero or more times\\
\lstinline[language=grammar]!$\ldots$ | $\ldots$! & Alternatives\\
\lstinline[language=grammar]!"$\mathit{text}$"! & The $\mathit{text}$ is treated as a single token (no white-space between any characters)\\
\hline
\end{tabular}
\end{center}

The following lexical units are defined (the ones in boldface are the
ones used in the grammar, the rest are just internal to the definition
Expand Down

0 comments on commit 246bab1

Please sign in to comment.