Added descriptions of the architecture

This commit is contained in:
Rolf Martin Glomsrud 2024-05-26 16:29:43 +02:00
parent 4ef8229057
commit 133b2807f2
2 changed files with 29 additions and 15 deletions

Binary file not shown.

View file

@ -6,39 +6,53 @@ In this chapter, the implementation of the tool utilizing the \DSL and \DSLSH wi
The architecture of the solution described in this thesis is illustrated in \figFull[fig:architecture]
In this tool, there exists two multiple ways to define a proposal, and each provide the same functionality, they only differ in syntax and writing-method. One can either write the definition in \DSL which utilizes Langium to parse the language, or one can use a JSON definition, which is more friendly as an API or people more familiar with JSON definitions.
In this tool, there exists two multiple ways to define a proposal, and each provide the same functionality, they only differ in syntax and writing-method. One can either write the definition in \DSL, or one can use the program API with \DSLSH, which is more friendly for programs to interact with.
\begin{figure}
In the architecture diagram, circular nodes show data passed into the program sections, and square nodes is a specific section of the program.
\begin{itemize}
\item \textbf{\DSL Code} is the raw text definition of proposals
\item \textbf{Self-Hosted Object} is the self-hosted version in \DSLSH format
\item \textbf{Langium Parser} takes raw \DSL source code, and parses it into a DSL
\item \textbf{Pre-parser} extracts the wildcards from the raw template definitions
\item \textbf{Prelude-builder} translates JavaScript prelude into array of wildcard strings
\item \textbf{Babel} parses the templates and the users source code into an AST
\item \textbf{Custom Tree Builder} translates the Babel AST structure into our tree structure
\item \textbf{Matcher} finds matches with \texttt{applicable to} template in user code
\item \textbf{Transformer} performs transformation defined in \texttt{transform to} template to each match of the users AST
\item \textbf{Generator} generates source code from the transformed user AST
\end{itemize}
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}[
roundnode/.style={ellipse, draw=red!60, fill=red!5, very thick, minimum size=7mm},
squarednode/.style={rectangle, draw=red!60, fill=red!5, very thick, minimum size=5mm}
]
\node[roundnode] (jstqlcode) {JSTQL Code};
\node[roundnode] (selfhostedjsoninput) [right=of jstqlcode] {Self-Hosted JSON};
\node[roundnode] (selfhostedjsoninput) [right=of jstqlcode] {Self-Hosted Object};
\node[squarednode] (langium) [below=of jstqlcode] {Langium Parser};
\node[squarednode] (jsonparser) [below=of selfhostedjsoninput] {Self-Hosted JSON parser};
\node[squarednode] (preludebuilder) [below=of jsonparser] {Prelude Builder};
\node[squarednode] (preParser) [below=of langium] {Pre-parser};
\node[squarednode] (babel) [below right=of preParser] {Babel};
\node[squarednode] (treebuilder) [below=of babel] {Custom AST builder};
\node[squarednode] (preludebuilder) [below=of selfhostedjsoninput] {Prelude Builder};
\node[squarednode] (preParser) [below left=of preludebuilder] {Pre-parser};
\node[squarednode] (babel) [below=of preParser] {Babel};
\node[roundnode] (usercode) [left=of babel] {User source code};
\node[squarednode] (treebuilder) [below=of babel] {Custom Tree builder};
\node[squarednode] (matcher) [below=of treebuilder] {Matcher};
\node[squarednode] (transformer) [below=of matcher] {Transformer};
\node[squarednode] (joiner) [below=of transformer] {Generator};
\draw[->] (jstqlcode.south) -- (langium.north);
\draw[->] (langium.south) -- (preParser.north);
\draw[->] (preParser.south) |- (babel.west);
\draw[->] (langium.south) |- (preParser.west);
\draw[->] (preParser.south) |- (babel.north);
\draw[->] (babel.south) -- (treebuilder.north);
\draw[->] (treebuilder.south) -- (matcher.north);
\draw[->] (matcher.south) -- (transformer.north);
\draw[->] (transformer.south) -- (joiner.north);
\draw[->] (selfhostedjsoninput.south) -- (jsonparser.north);
\draw[->] (jsonparser.south) -- (preludebuilder.north);
\draw[->] (preludebuilder.south) |- (babel.east);
\draw[->] (selfhostedjsoninput.south) -- (preludebuilder.north);
\draw[->] (preludebuilder.south) |- (preParser.east);
\draw[->] (usercode.east) -- (babel.west);
\end{tikzpicture}
\end{center}