diff options
Diffstat (limited to 'Homework/cs5300/homework-three/compilers_assn_3.tex')
| -rw-r--r-- | Homework/cs5300/homework-three/compilers_assn_3.tex | 227 |
1 files changed, 227 insertions, 0 deletions
diff --git a/Homework/cs5300/homework-three/compilers_assn_3.tex b/Homework/cs5300/homework-three/compilers_assn_3.tex new file mode 100644 index 0000000..bf3bdd8 --- /dev/null +++ b/Homework/cs5300/homework-three/compilers_assn_3.tex @@ -0,0 +1,227 @@ +% Created 2023-02-01 Wed 00:48 +% Intended LaTeX compiler: pdflatex +\documentclass[11pt]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{capt-of} +\usepackage{hyperref} +\notindent \notga \usepackage{ dsfont } \usepackage{amsmath} +\author{Logan Hunt} +\date{\today} +\title{Assignment Three} +\hypersetup{ + pdfauthor={Logan Hunt}, + pdftitle={Assignment Three}, + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 28.2 (Org mode 9.6.1)}, + pdflang={English}} +\begin{document} + +\maketitle +\setlength\parindent{0pt} + +\section{Question One} +\label{sec:orgdf8aa7e} +\begin{verbatim} +<void> <id, cube> <(> <float> <id, y> <)> <{> + <if> <(> <id, y> <comparison, >> <number, 3.14159> <)> \\ + <return> <id, y> <mult_op> <id, y> <mult_op> <id, y> + <return> <number, -1> +<}> +\end{verbatim} + +\section{Question Two} +\label{sec:orgdde4dcf} +\begin{center} +\includegraphics[width=250px]{./2.png} +\end{center} + +The first buffer is filled twice. The second is filled once, and the last contains three elements. +\section{Question Three} +\label{sec:org265d5c8} +Strings starting and ending with "x" with any number of x or y's in between. + +\section{Question Four} +\label{sec:org2c5df0e} +\subsection{a} +\label{sec:orgbea3125} +\begin{verbatim} +col(o|ou)r +\end{verbatim} +\subsection{b} +\label{sec:org3be70df} +\begin{verbatim} +m(o|u)m +\end{verbatim} +\subsection{c} +\label{sec:org79ea881} +\begin{verbatim} +analy(z|s)e +\end{verbatim} + +\section{Question Five} +\label{sec:org29ab12a} +\subsection{a} +\label{sec:org9be87fc} +\begin{enumerate} +\item bbbaa +\item bbbcc +\item bbbac +\item bbbca +\end{enumerate} +\subsection{b} +\label{sec:org7c1600e} +\begin{enumerate} +\item bbb +\item aa +\item cc +\item ac +\item ca +\end{enumerate} +\subsection{c} +\label{sec:orgc0a6132} +\begin{enumerate} +\item bbb +\item acac +\end{enumerate} +\subsection{d} +\label{sec:org7e7a221} +\begin{enumerate} +\item bbbacac +\end{enumerate} + +\section{Question Six} +\label{sec:org4ae00e1} +\subsection{a} +\label{sec:org95b78bd} +\begin{verbatim} +In [1]: ["aggie"[0:n] for n in range(0, len("aggie")+1)] +Out[1]: ['', 'a', 'ag', 'agg', 'aggi', 'aggie'] +\end{verbatim} + +\subsection{b} +\label{sec:orge1463c6} +\begin{verbatim} +In [3]: ["aggie"[n:len("aggie")] for n in range(0, len("aggie")+1)] +Out[3]: ['aggie', 'ggie', 'gie', 'ie', 'e', ''] +\end{verbatim} + +\subsection{c} +\label{sec:org8c9e2bb} +\begin{verbatim} +In [4]: ["aggie"[0:n] for n in range(1, len("aggie"))] +Out[4]: ['a', 'ag', 'agg', 'aggi'] +\end{verbatim} + +\subsection{d} +\label{sec:org1e2b7fd} +\begin{verbatim} +In [8]: def subs(s): + ...: proper_substrings = set() + ...: for i in range(len(s)+1): + ...: for j in range(len(s)+1): + ...: if (i <= j): + ...: sub = s[i:j] + ...: if (sub != "" and sub != s): + ...: proper_substrings.add(sub) + ...: return proper_substrings + ...: + +In [9]: subs("aggie") +Out[9]: +{'a', + 'ag', + 'agg', + 'aggi', + 'e', + 'g', + 'gg', + 'ggi', + 'ggie', + 'gi', + 'gie', + 'i', + 'ie'} +\end{verbatim} + +\section{Question Seven} +\label{sec:org7f2ee0a} +\begin{verbatim} +(u|U)(n|N)(i|I)(o|O)(n|N) +\end{verbatim} + +\section{Question Eight} +\label{sec:orgc132ce5} +\(\textdollar([0-9]|[0-9]^2|[0-9]^3)(,[0-9]^3)^*.[0-9][0-9]\) + +\section{Question Nine} +\label{sec:orgaafffb5} +nonzeroDigit \(\Rightarrow\) 1|2|3|4|5|6|7|8|9|A|B|C|D|E|F + +hex \(\Rightarrow\) nonzeroDigit\textsuperscript{+}(0|nonzeroDigit)\textsuperscript{*} + +\section{Question Ten} +\label{sec:org00e8901} +\subsection{a} +\label{sec:org06fd6db} +\begin{verbatim} +(0011)*|(1100)* +\end{verbatim} +\subsection{b} +\label{sec:orgdb7ace2} +\begin{center} +\includegraphics[width=.9\linewidth]{./10b.png} +\end{center} + +\begin{verbatim} +((00)|(0(11)*0?))|((11)|(1(00)*1?)) +\end{verbatim} +\subsection{c} +\label{sec:org754d92f} +\begin{verbatim} +a?b?c?d? +\end{verbatim} + +\section{Question Eleven} +\label{sec:org1470498} +\subsection{a} +\label{sec:org7adfc46} +\begin{verbatim} +(\t| )+ +\end{verbatim} +\subsection{b} +\label{sec:orgda2b5ea} +\begin{verbatim} +(/\*)[^(*/)]*(\*/) +\end{verbatim} +\subsection{c} +\label{sec:org21471a7} +\begin{verbatim} +"[^"]*" +\end{verbatim} + +\section{Question Twelve} +\label{sec:org4ac98dc} + +nonVowelPart \(\Rightarrow\) [\textasciicircum aeiou]\textsuperscript{*} + +aPart \(\Rightarrow\) a\textsuperscript{+}[\textasciicircum eiou]\textsuperscript{*} + +ePart \(\Rightarrow\) e\textsuperscript{+}[\textasciicircum aiou]\textsuperscript{*} + +iPart \(\Rightarrow\) i\textsuperscript{+}[\textasciicircum aeou]\textsuperscript{*} + +oPart \(\Rightarrow\) o\textsuperscript{+}[\textasciicircum aeiu]\textsuperscript{*} + +uPart \(\Rightarrow\) u\textsuperscript{+} [\textasciicircum aeio]\textsuperscript{*} + +str \(\Rightarrow\) (nonVowelPart)(aPart)(ePart)(iPart)(oPart)(uPart) +\end{document}
\ No newline at end of file |
