From: Mart Lubbers Date: Wed, 13 Apr 2016 17:46:17 +0000 (+0200) Subject: a X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=eebf260cfb0f6fa5c97250dabd50e7b98281a381;p=cc1516.git a --- diff --git a/deliverables/p2doc/Makefile b/deliverables/p2doc/Makefile new file mode 100644 index 0000000..37d4c03 --- /dev/null +++ b/deliverables/p2doc/Makefile @@ -0,0 +1,18 @@ +LATEX:=pdflatex +LATEXFLAGS:= +DOCUMENT:=p2 + +.PHONY: all clean +.SECONDARY: $(DOCUMENT).fmt + +all: $(DOCUMENT).pdf + +%.pdf: %.tex %.fmt + $(LATEX) $(LATEXFLAGS) $(basename $@) + $(LATEX) $(LATEXFLAGS) $(basename $@) + +%.fmt: pre.tex + $(LATEX) $(LATEXFLAGS) -ini -jobname="$(basename $@)" "&$(LATEX) $<\dump" + +clean: + $(RM) -v $(addprefix $(DOCUMENT).,aux fmt log nav out snm toc vrb) diff --git a/deliverables/p2doc/clean.sty b/deliverables/p2doc/clean.sty new file mode 100644 index 0000000..046c239 --- /dev/null +++ b/deliverables/p2doc/clean.sty @@ -0,0 +1,70 @@ +\usepackage{listings} + +\lstdefinelanguage{Clean}{% + alsoletter={ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_`1234567890}, + alsoletter={~!@\#$\%^\&*-+=?<>:|\\.}, + morekeywords={generic,implementation,definition,dynamic,module,import,from,where,in,of,case,let,infix,infixr,infixl,class,instance,with,if,derive}, + sensitive=true, + morecomment=[l]{//}, + morecomment=[n]{/*}{*/}, + morestring=[b]", + morestring=[b]', + emptylines=1, + basicstyle=\small, + identifierstyle=\small\ttfamily, + commentstyle=\itshape, + keywordstyle=\bfseries, + stringstyle=\ttfamily, + numbers=none, + showstringspaces=false, + basewidth=0.45em, + columns=[c]fixed, + keepspaces=true, + breaklines=false, + tabsize=4, + texcl=true, + escapeinside={(\#}{\#)}, + literate=% + % Basic Clean constructs + {\\}{{$\lambda\:$}}1 + {A.}{{$\forall\;\,$}}1 + {E.}{{$\exists\;\,$}}1 + {>}{{$>$}}1 + {<}{{$<$}}1 + {<=}{{$\leq$}}1 + {>=}{{$\geq$}}1 + {<>}{{$\neq$}}1 + {->}{{$\rightarrow$}}2 + {<-}{{$\leftarrow$}}1 + {=}{{$=$}}1 + {~}{{$\sim$}}1 + {\#}{{$\sharp$}}1 + {\{|}{{$\{\!|\!$}}1 + {|\}}{{$\!|\!\}$}}1 + {:=}{{$:=$}}2 + {==}{{$==$}}2 + {++}{{$+\!\!+$}}2 + {+++}{{$+\!\!\!\!+\!\!\!\!+$}}2 + {:==}{{$:==$}}3 + {\{|*|\}}{{$\{\!|\!\!\star\!\!|\!\}$}}3 + % + % Basic iTask constructs + {>||>}{{$\triangleright\triangleright$}}2 + {>>=}{{\texttt{>>=}}}3 + {>>|}{{\texttt{>>|}}}3 + {?>>}{{\texttt{?>>}}}3 + {!>>}{{\texttt{!>>}}}3 + {-||-}{{\texttt{-||-}}}4 + {.||.}{{\texttt{.||.}}}4 + {.&&.}{{\texttt{.\&\&.}}}4 +} + +\newcommand{\CleanInline}[1]{\lstinline[language=Clean]¦#1¦} +\newcommand{\CI}[1]{\CleanInline{#1}} + +\lstdefinestyle{numbers}{numbers=left, stepnumber=1, numberstyle=\tiny, numbersep=5pt} + +\lstnewenvironment{CleanCode}{\lstset{language=Clean,identifierstyle=\ttfamily}}{} +\lstnewenvironment{CleanCodeN}{\lstset{language=Clean,style=numbers}}{} +\lstnewenvironment{CleanCodeB}{\lstset{language=Clean,frame=single}}{} +\lstnewenvironment{CleanCodeNB}{\lstset{language=Clean,style=numbers,frame=single}}{} diff --git a/deliverables/p2doc/p2.tex b/deliverables/p2doc/p2.tex new file mode 100644 index 0000000..376d733 --- /dev/null +++ b/deliverables/p2doc/p2.tex @@ -0,0 +1,7 @@ +%&p2 +\begin{document} +\maketitle + + + +\end{document} diff --git a/deliverables/p2doc/pre.tex b/deliverables/p2doc/pre.tex new file mode 100644 index 0000000..ab0855b --- /dev/null +++ b/deliverables/p2doc/pre.tex @@ -0,0 +1,14 @@ +\documentclass{article} + +\usepackage{xcolor} +\usepackage{listings} +\usepackage{clean} + +\title{cc1516: Semantic analysis} +\author{P. Jager\and M. Lubbers} +\date{\today} + +\lstset{% + basicstyle=\ttfamily\footnotesize, + breaklines +} diff --git a/sem.icl b/sem.icl index 0335e74..8dff548 100644 --- a/sem.icl +++ b/sem.icl @@ -118,9 +118,6 @@ checkStmt t r=:(FunStmt (FunCall f es)) = typeFun f es >>| pure r checkStmt VoidType r=:(ReturnStmt Nothing) = pure r checkStmt t r=:(ReturnStmt (Just e)) = unify t e >>| pure r -all :: [Bool] -> Bool -all as = foldr (&&) True as - typeExpr :: Expr -> Env Type typeExpr (IntExpr _ _) = pure IntType typeExpr (CharExpr _ _) = pure CharType