Skip to content

Commit fdc35fc

Browse files
Update documentation
1 parent c947b2e commit fdc35fc

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

docs/documentation.tex

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
\usepackage[backend=biber,sorting=none]{biblatex}
33
\usepackage{tikz}
44
\usepackage{tikz-uml}
5+
\usetikzlibrary{automata}
56

67
\tikzumlset{
78
fill component=yellow!0
@@ -98,9 +99,9 @@ \subsubsection{Representation of Numbers}\label{sec:grammar-numbers}
9899
\subsubsection{Identifiers and Variables}\label{sec:grammar-id}
99100

100101
A preliminary grammar to represents variables' identifiers is here presented.
101-
The IMP language recognizes alphanumeric identifiers that start with a lower
102-
case letter. The recognized letters are the letters from ``a'' to ``z'', both
103-
in upper and lower case.
102+
This implementation of the IMP language recognizes alphanumeric identifiers
103+
that start either with a lower or upper case letter. The recognized letters are
104+
the letters from ``a'' to ``z'', both in upper and lower case.
104105

105106
\begin{grammar}
106107
<identifier> ::= <upper> <alphanum>
@@ -201,9 +202,24 @@ \section{Additions to the Syntax Given During Lectures}\label{sec:additions}
201202
code. Comments start with an hash (``\texttt{\#}'') and span for the
202203
entire lines. This is a behaviour inspired by commonly used programming
203204
languages like the POSIX Shell Command Language \cite{shell-syntax} or
204-
Python \cite{python-syntax}.
205+
Python \cite{python-syntax}.The finite state automaton used to
206+
recognized the comments is shown in \autoref{fig:comment-automaton}.
205207
\end{itemize}
206208
209+
\begin{figure}[H]
210+
\centering
211+
\begin{tikzpicture}[node distance=3cm,->,>=stealth']
212+
\node[state, initial] (q0) {$q_0$};
213+
\node[state, accepting, right of=q0] (q1) {$q_1$};
214+
215+
\draw (q0) edge[loop above] node{$\ast - \texttt{"a"}$} (q0)
216+
(q0) edge[above] node{\texttt{\#}} (q1)
217+
(q1) edge[loop above] node{$\ast$} (q1);
218+
\end{tikzpicture}
219+
\caption[Finite state automaton to recognize comments]{Finite state automaton to recognize comments. The $\ast$ symbol denotes all characters. The notation $\ast - \texttt{"a"}$ denotes all characters except ``a''.}
220+
\label{fig:comment-automaton}
221+
\end{figure}
222+
207223
\chapter{Design}
208224
209225
The SIMPLI interpreter was defined by following a strategy that is similar to

0 commit comments

Comments
 (0)