Skip to content

Commit

Permalink
tr: Add references for tools used
Browse files Browse the repository at this point in the history
  • Loading branch information
nc-cl committed Mar 28, 2018
1 parent 15b1f37 commit e0a74a9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
8 changes: 4 additions & 4 deletions doc/Technical_Report/Jarlang Technical Report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ \section{Project Results}
\end{itemize}

\subsection{The Jarlang Runtime Environment}
The Jarlang runtime environment is implemented in many separate JavaScript modules, which are processed and bound together by our NodeJS toolchain and tools such as \textit{Gulp}. The runtime is split into three distinct segments.
The Jarlang runtime environment is implemented in many separate JavaScript modules, which are processed and bound together by our NodeJS toolchain and tools such as \textit{Gulp} \citep{gulpGitHub}. The runtime is split into three distinct segments.

\begin{itemize}
\item Erlang Datatypes - Each Erlang datatype implemented as an ES6-spec JavaScript class in its own closure to keep track of private and public methods/properties.
Expand Down Expand Up @@ -363,7 +363,7 @@ \subsubsection{The JavaScript AST}
\subsubsection{estree.erl and json.erl}
\textit{estree.erl} is an implementation of the JavaScript AST interface as defined by the Mozilla Foundation (\citeyear{EStreeMDN}) as well as reverse engineering the AST node structure of newer as of yet not-officially-defined AST nodes.

\textit{estree.erl} went through many changes during the course of the project as our needs grew. It originally simply tried to mimic the format and semantics of JSON by using Maps and Lists in place of JSON objects and arrays. This allowed us to easily implement new nodes into our interface but also meant that standard Erlang tools such as \textit{Dialyzer (static type analysis for Erlang code)} wouldn't work as it doesn't support matching specific entries at certain positions in Lists nor Maps.
\textit{estree.erl} went through many changes during the course of the project as our needs grew. It originally simply tried to mimic the format and semantics of JSON by using Maps and Lists in place of JSON objects and arrays. This allowed us to easily implement new nodes into our interface but also meant that standard Erlang tools such as \textit{Dialyzer (static type analysis for Erlang code)} \citep{dialyzerPdf} wouldn't work as it doesn't support matching specific entries at certain positions in Lists nor Maps.

We tried working around this issue by writing our own naive type checker which we quickly realised was not extensible nor a good idea in the long run. We then heavily refactored \textit{estree.erl} to use a custom datatstructure made up of nested tagged tuples. You can see an example of both pre-factored \textit{estree.erl} code and post-refactored \textit{estree.erl} in Figures \ref{fig:estree_old:erl} \& \ref{fig:estree_new:erl} respectively in Appendix A.

Expand Down Expand Up @@ -396,9 +396,9 @@ \subsubsection{Erlang Module Implementation} \label{sssec:num1}
Module attributes are also encoded as object parameters and are ready to be returned and used by standard compiler generated debug functions though this is disabled by default as generally these attributes aren't used.

\subsubsection{Outputting JavaScript \& Other Tools}
Once we've completely descended through the Core Erlang AST for a given module and have successfully translated it into an equivalent JavaScript AST, we simple write the JavaScript AST out to a temporary file. We then spawn a new shell process which calls NodeJS which is a pre-requesite for this project, which then runs our wrapper around an open-source NodeJS library --- \textit{escodegen.js} --- to convert a JavaScript AST into code.
Once we've completely descended through the Core Erlang AST for a given module and have successfully translated it into an equivalent JavaScript AST, we simple write the JavaScript AST out to a temporary file. We then spawn a new shell process which calls NodeJS which is a pre-requesite for this project, which then runs our wrapper around an open-source NodeJS library --- \textit{escodegen.js} \citep{escodegenGitHub} --- to convert a JavaScript AST into code.

In order to make the user experience of Jarlang better and simpler, we also wrote a free and open source package builder for our project called \textit{Erlpkg} which does things such as handler our command line argument parsing needs, as well and compressing all of our compiled Erlang source code modules into one binary file. This is because while there are official build tools for Erlang, we did not write Jarlang in line with the OTP specification which is required for these official build tools, and it was too late into the project to refactor what does work, and works well.
In order to make the user experience of Jarlang better and simpler, we also wrote a free and open source package builder for our project called \textit{Erlpkg} \citep{erlpkgGitHub} which does things such as handler our command line argument parsing needs, as well and compressing all of our compiled Erlang source code modules into one binary file. This is because while there are official build tools for Erlang, we did not write Jarlang in line with the OTP specification which is required for these official build tools, and it was too late into the project to refactor what does work, and works well.

\blankpage
\section{Conclusions}
Expand Down
36 changes: 34 additions & 2 deletions doc/Technical_Report/jarlang_technical_report.bib
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
@online{erlpkgGitHub,
author = {Chris Bailey},
title = {Erlpkg Github Archive},
date = {2018-22-03},
year = {2018},
note = {\url{https://github.com/Vereis/erlpkg}}
}

@online{dialyzerPdf,
author = {{Ericsson AB}},
title = {Dialyzer},
date = {2018-13-03},
year = {2018},
note = {\url{http://erlang.org/doc/apps/dialyzer/dialyzer.pdf}}
}

@online{escodegenGitHub,
author = {{ECMAScript Tooling}},
title = {Escodegen Github Archive},
date = {2018-26-02},
year = {2018},
note = {\url{https://github.com/estools/escodegen}}
}

@online{gulpGitHub,
author = {{Gulp}},
title = {Gulp JS Github Archive},
date = {2018-14-02},
year = {2018},
note = {\url{https://github.com/gulpjs/gulp}}
}

@online{luvvieWeb,
author = {Gordon Guthrie},
title = {Luvvie Script Website},
Expand Down Expand Up @@ -31,9 +63,9 @@ @online{ShenGitHub
}

@online{EStreeMDN,
author = {Mozilla Foundation},
author = {{Mozilla Foundation}},
title = {Parser API},
date = {2017-12-05},
year = {2017},
note = {\url{https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API}}
}
}

0 comments on commit e0a74a9

Please sign in to comment.