summaryrefslogtreecommitdiff
path: root/Homework/cs5300/homework-three
diff options
context:
space:
mode:
Diffstat (limited to 'Homework/cs5300/homework-three')
-rw-r--r--Homework/cs5300/homework-three/10b.pngbin0 -> 132986 bytes
-rw-r--r--Homework/cs5300/homework-three/2.pngbin0 -> 23871 bytes
-rw-r--r--Homework/cs5300/homework-three/4ee134d048f8b6933168eb850fdc47da-emacs-elixir-format.ex1
-rw-r--r--Homework/cs5300/homework-three/compilers_assn_3.org165
-rw-r--r--Homework/cs5300/homework-three/compilers_assn_3.pdfbin0 -> 268801 bytes
-rw-r--r--Homework/cs5300/homework-three/compilers_assn_3.tex227
6 files changed, 393 insertions, 0 deletions
diff --git a/Homework/cs5300/homework-three/10b.png b/Homework/cs5300/homework-three/10b.png
new file mode 100644
index 0000000..704e444
--- /dev/null
+++ b/Homework/cs5300/homework-three/10b.png
Binary files differ
diff --git a/Homework/cs5300/homework-three/2.png b/Homework/cs5300/homework-three/2.png
new file mode 100644
index 0000000..391e2ab
--- /dev/null
+++ b/Homework/cs5300/homework-three/2.png
Binary files differ
diff --git a/Homework/cs5300/homework-three/4ee134d048f8b6933168eb850fdc47da-emacs-elixir-format.ex b/Homework/cs5300/homework-three/4ee134d048f8b6933168eb850fdc47da-emacs-elixir-format.ex
new file mode 100644
index 0000000..7a71d35
--- /dev/null
+++ b/Homework/cs5300/homework-three/4ee134d048f8b6933168eb850fdc47da-emacs-elixir-format.ex
@@ -0,0 +1 @@
+File compilers_assn_3.pdf changed on disk. Reread from disk? (yes or no) \ No newline at end of file
diff --git a/Homework/cs5300/homework-three/compilers_assn_3.org b/Homework/cs5300/homework-three/compilers_assn_3.org
new file mode 100644
index 0000000..0d4028e
--- /dev/null
+++ b/Homework/cs5300/homework-three/compilers_assn_3.org
@@ -0,0 +1,165 @@
+#+TITLE: Assignment Three
+#+AUTHOR: Logan Hunt
+#+STARTUP: entitiespretty fold inlineimages
+#+LATEX_HEADER: \notindent \notga \usepackage{ dsfont } \usepackage{amsmath}
+#+LATEX: \setlength\parindent{0pt}
+#+OPTIONS: toc:nil
+
+* Question One
+\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}
+
+* Question Two
+#+attr_latex: :width 250px
+[[./2.png]]
+
+The first buffer is filled twice. The second is filled once, and the last contains three elements.
+* Question Three
+Strings starting and ending with "x" with any number of x or y's in between.
+
+* Question Four
+** a
+\begin{verbatim}
+col(o|ou)r
+\end{verbatim}
+** b
+\begin{verbatim}
+m(o|u)m
+\end{verbatim}
+** c
+\begin{verbatim}
+analy(z|s)e
+\end{verbatim}
+
+* Question Five
+** a
+1. bbbaa
+2. bbbcc
+3. bbbac
+4. bbbca
+** b
+1. bbb
+2. aa
+3. cc
+4. ac
+5. ca
+** c
+1. bbb
+2. acac
+** d
+1. bbbacac
+
+* Question Six
+** a
+\begin{verbatim}
+In [1]: ["aggie"[0:n] for n in range(0, len("aggie")+1)]
+Out[1]: ['', 'a', 'ag', 'agg', 'aggi', 'aggie']
+\end{verbatim}
+
+** b
+\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}
+
+** c
+\begin{verbatim}
+In [4]: ["aggie"[0:n] for n in range(1, len("aggie"))]
+Out[4]: ['a', 'ag', 'agg', 'aggi']
+\end{verbatim}
+
+** d
+\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}
+
+* Question Seven
+\begin{verbatim}
+(u|U)(n|N)(i|I)(o|O)(n|N)
+\end{verbatim}
+
+* Question Eight
+$\textdollar([0-9]|[0-9]^2|[0-9]^3)(,[0-9]^3)^*.[0-9][0-9]$
+
+* Question Nine
+nonzeroDigit \Rightarrow 1|2|3|4|5|6|7|8|9|A|B|C|D|E|F
+
+hex \Rightarrow nonzeroDigit^{+}(0|nonzeroDigit)^{*}
+
+* Question Ten
+** a
+\begin{verbatim}
+(0011)*|(1100)*
+\end{verbatim}
+** b
+[[./10b.png]]
+
+\begin{verbatim}
+((00)|(0(11)*0?))|((11)|(1(00)*1?))
+\end{verbatim}
+** c
+\begin{verbatim}
+a?b?c?d?
+\end{verbatim}
+
+* Question Eleven
+** a
+\begin{verbatim}
+(\t| )+
+\end{verbatim}
+** b
+\begin{verbatim}
+(/\*)[^(*/)]*(\*/)
+\end{verbatim}
+** c
+\begin{verbatim}
+"[^"]*"
+\end{verbatim}
+
+* Question Twelve
+
+nonVowelPart \Rightarrow [\textasciicircum aeiou]^{*}
+
+aPart \Rightarrow a^{+}[\textasciicircum eiou]^{*}
+
+ePart \Rightarrow e^{+}[\textasciicircum aiou]^{*}
+
+iPart \Rightarrow i^{+}[\textasciicircum aeou]^{*}
+
+oPart \Rightarrow o^{+}[\textasciicircum aeiu]^{*}
+
+uPart \Rightarrow u^{+} [\textasciicircum aeio]^{*}
+
+str \Rightarrow (nonVowelPart)(aPart)(ePart)(iPart)(oPart)(uPart)
+
+
diff --git a/Homework/cs5300/homework-three/compilers_assn_3.pdf b/Homework/cs5300/homework-three/compilers_assn_3.pdf
new file mode 100644
index 0000000..91306db
--- /dev/null
+++ b/Homework/cs5300/homework-three/compilers_assn_3.pdf
Binary files differ
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