Skip to content
Open
6 changes: 3 additions & 3 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1093,13 +1093,13 @@ \section{Derivatives and Inverses of Functions}\label{derivatives-and-inverses-o

\begin{annotationdefinition}[smoothOrder]
\begin{synopsis}[grammar]\begin{lstlisting}
"smoothOrder" "=" UNSIGNED-NUMBER
"smoothOrder" "=" UNSIGNED-INTEGER
"smoothOrder"
"("
"normallyConstant" "=" IDENT
{ "," "normallyConstant" "=" IDENT }
")"
"=" UNSIGNED-NUMBER
"=" UNSIGNED-INTEGER
\end{lstlisting}\end{synopsis}
\begin{semantics}
This annotation has only an effect within a function declaration.
Expand Down Expand Up @@ -1137,7 +1137,7 @@ \section{Derivatives and Inverses of Functions}\label{derivatives-and-inverses-o
"(" derivative-constraint { "," derivative-constraint } ")"

derivative-constraint :
"order" = UNSIGNED-NUMBER
"order" = UNSIGNED-INTEGER
| "noDerivative" = IDENT
| "zeroDerivative" = IDENT
\end{lstlisting}\end{synopsis}
Expand Down
9 changes: 6 additions & 3 deletions chapters/syntax.tex
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ \subsection{Expressions}\label{expressions1}
primary [ ( "^" | ".^" ) primary ]

primary :
UNSIGNED-NUMBER
numeric
| STRING
| false
| true
Expand All @@ -405,8 +405,11 @@ \subsection{Expressions}\label{expressions1}
| "{" array-arguments "}"
| end

UNSIGNED-NUMBER :
UNSIGNED-INTEGER | UNSIGNED-REAL
numeric :
( UNSIGNED-INTEGER | UNSIGNED-REAL ) [ unit-of-measurement ]

unit-of-measurement :
Q-IDENT

type-specifier :
["."] name
Expand Down
10 changes: 10 additions & 0 deletions chapters/unitexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,13 @@ \section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}

The unit expression \lstinline!"T"! means tesla, but note that the letter \lstinline!T! is also the symbol for the prefix tera which has a multiplier value of 10\textsuperscript{12}.
\end{example}


\section{Unitful Literals}

The \lstinline[language=grammar]!numeric! in the grammar allows a unit to be attached to a numeric value.
In this case, the unit is given as a \lstinline[language=grammar]!Q-IDENT! rather than a string, since the use of a string could be ambiguity interpreted as \lstinline[language=grammar]!description-string! in some contexts.

\begin{example}
An acceleration of 9.8 meters per square second can be expressed as \lstinline!9.8'm/s2'!.
\end{example}