From: Mart Lubbers Date: Thu, 26 May 2016 20:17:59 +0000 (+0200) Subject: started with report X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=379e8e80513b4e61bb4994bed0b134be89ee5120;p=cc1516.git started with report --- diff --git a/deliverables/report/Makefile b/deliverables/report/Makefile new file mode 100644 index 0000000..b0df60a --- /dev/null +++ b/deliverables/report/Makefile @@ -0,0 +1,14 @@ +LATEX:=pdflatex +LATEXFLAGS:= +DOCUMENT:=report + +.PHONY: all clean + +all: $(DOCUMENT).pdf + +%.pdf: %.tex ext.tex gen.tex pars.tex sem.tex + $(LATEX) $(LATEXFLAGS) $< + $(LATEX) $(LATEXFLAGS) $< + +clean: + $(RM) -v $(addprefix $(DOCUMENT).,aux log nav out snm toc vrb pdf) diff --git a/deliverables/report/clean.sty b/deliverables/report/clean.sty new file mode 100644 index 0000000..046c239 --- /dev/null +++ b/deliverables/report/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/report/ext.tex b/deliverables/report/ext.tex new file mode 100644 index 0000000..919338e --- /dev/null +++ b/deliverables/report/ext.tex @@ -0,0 +1,42 @@ +\section{Extensions} +\subsection{Higher order functions} + +\subsection{Syntactic sugars} +Several small syntactic sugars have been added on several levels of processing +to make writing programs more easy. + +\subsubsection{Literal strings} +While there are no literal strings one can print lists of characters. Entering +lists of characters can be cumbersome and therefore a shorthand notation is +added to define literal strings using double quotes. During the lexing phase +the string is lexed as a single token and during parsing the token is +transformed to a equal character list representation. The following example +shows the syntax before transformation and the syntax after. Note that just as +in characters, literal strings can contain escape characters. + +\begin{SPLCode} +//Before transformation +var a = "Hello world!"; +//After transformation +var a = 'H':'e':'l':'l':'o':' ':'w':'o':'r':'l':'d':'!':[] +\end{SPLCode} + +\subsubsection{Anonymous functions} +%TODO + +\subsubsection{Variable arguments printing} +To ease the programmer we have included a parse-level transformation that +transforms \SI{print} with multiple arguments to multiple \SI{print} function +calls with a single argument. The following example shows the syntax before the +transformation and the syntax after the transformation. + +\begin{SPLCode} +//Before transformation +print("abc", 42, 'c', "da\n"); + +//After transformation +print('a':'b':'c':[]); +print(42); +print('c'); +print('d':'a':'\n':[]); +\end{SPLCode} diff --git a/deliverables/report/gen.tex b/deliverables/report/gen.tex new file mode 100644 index 0000000..9047b7b --- /dev/null +++ b/deliverables/report/gen.tex @@ -0,0 +1 @@ +\section{Code generation} diff --git a/deliverables/report/pars.tex b/deliverables/report/pars.tex new file mode 100644 index 0000000..6d694ad --- /dev/null +++ b/deliverables/report/pars.tex @@ -0,0 +1 @@ +\section{Lexing \& parsing} diff --git a/deliverables/report/report.tex b/deliverables/report/report.tex new file mode 100644 index 0000000..d3f4349 --- /dev/null +++ b/deliverables/report/report.tex @@ -0,0 +1,27 @@ +\documentclass[titlepage]{article} + +\usepackage{listings} +\usepackage{clean} +\usepackage{spl} +\usepackage[a4paper]{geometry} + +\title{SPLC} +\author{Pim Jager\and Mart Lubbers} +\date{\today} + +\lstset{% + basicstyle=\ttfamily\footnotesize, + breaklines +} + +\begin{document} +\maketitle +\input{pars.tex} + +\input{sem.tex} + +\input{gen.tex} + +\input{ext.tex} + +\end{document} diff --git a/deliverables/report/sem.tex b/deliverables/report/sem.tex new file mode 100644 index 0000000..6ea0f3d --- /dev/null +++ b/deliverables/report/sem.tex @@ -0,0 +1 @@ +\section{Semantic analysis} diff --git a/deliverables/report/spl.sty b/deliverables/report/spl.sty new file mode 100644 index 0000000..3d567d4 --- /dev/null +++ b/deliverables/report/spl.sty @@ -0,0 +1,30 @@ +\usepackage{listings} + +\lstdefinelanguage{SPLCode}{% + alsoletter={ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_1234567890}, + morekeywords={print,isEmpty,if,else,while}, + sensitive=true, + morecomment=[l]{//}, + morecomment=[n]{/*}{*/}, + morestring=[b]", + morestring=[b]', + basicstyle=\small, + identifierstyle=\small\ttfamily, + commentstyle=\itshape, + keywordstyle=\bfseries, + stringstyle=\ttfamily, + showstringspaces=false, + basewidth=0.45em, + columns=[c]fixed, + keepspaces=true, + breaklines=true, + tabsize=4, + texcl=true, +} + +\newcommand{\SPLInline}[1]{\lstinline[language=SPLCode]¦#1¦} +\newcommand{\SI}[1]{\SPLInline{#1}} + +\lstdefinestyle{numbers}{numbers=left, stepnumber=1, numberstyle=\tiny, numbersep=5pt} + +\lstnewenvironment{SPLCode}{\lstset{language=SPLCode}}{}