Skip to content

Commit

Permalink
complete semantic part
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdihaghverdi committed Dec 29, 2023
1 parent 8c3d3ec commit 8b8e522
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Binary file modified Extra3/RTP-EXTRA03-02-4003613023.pdf
Binary file not shown.
41 changes: 40 additions & 1 deletion Extra3/docs/structure.tex
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,43 @@ \section{ساختار یک کامپایلر}
\end{center}
\end{figure}
\end{itemize}
\end{frame}
\end{frame}

\begin{frame}{تحلیل معنایی \lr{(Semantic Analysis)}}
\begin{itemize}\itemr
\item[-]
درخت تولید شده در مرحله‌ی قبل، به این قسمت فرستاده می‌شود.

\item[-]
در این قسمت، درخت تولید شده با اطلاعاتی دیگری همچون
\lr{type}
متغیر‌ها بررسی می‌شود، و اگر تداخلی با زبان داشت، گزارش می‌شود. برای مثال یک زبان اجازه جمع شدن یک
\lr{\texttt{float}}
با یک
\lr{\texttt{int}}
را نمی‌دهد که در این مرحله این اشتباه کشف و گزارش می‌شود.

\item[-]
همینطور، این قسمت اگر بتواند
\lr{type case}
مناسبی را انجام دهد، این کار را می‌کند. در مثال ما، متغیر‌های
\lr{\texttt{position}}،
\lr{\texttt{initial}}
و
\lr{\texttt{rate}}
از نوع
\lr{\texttt{float}}
تعریف شده‌اند و عدد
\lr{\texttt{60}}
هم باید به

\lr{\texttt{float}}
تبدیل می‌شود.

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.3\textwidth, height=0.31\textheight]{docs/images/semantic}
\end{center}
\end{figure}
\end{itemize}
\end{frame}

0 comments on commit 8b8e522

Please sign in to comment.