Cleanup and initial Background

This commit is contained in:
Rolf Martin Glomsrud 2024-05-29 21:13:47 +02:00
parent 3808f97ef5
commit 5e2eb91434
7 changed files with 58 additions and 25 deletions

Binary file not shown.

View file

@ -78,13 +78,16 @@ Babels main feature is \texttt{@babel/parse}~\cite{BabelParser} and its plugins.
Source code querying is a technique used to extract information from source code. Since source code is just structured text, one can treat it as a database, allowing for queries to be written and perform operations on that data.
Source code Querying enables developers to search through their code for specific patterns based on a query written. These queries can come in many different forms. Such as SQL-like queris, structured queries,
Source code Querying enables developers to search through their code for specific patterns based on a query written. These queries can come in many different forms. Such as SQL-like queries, structured queries,
This kind of querying is very useful for programs such as Integrated Development Environments, source code transformations, and other tasks which require searching through code. An example of source code querying being used in an IDE is Jetbrains structural search and replace~\cite{StructuralSearchAndReplaceJetbrains}.
\section{Domain Specific languages}
\section{Language Workbenches}
\subsection*{Language Workbenches}
One part of creating a software language is the tooling for that language. Most modern software languages are backed by some form of tooling, one important tool for a language is the language server. This is created to allow for features such as syntax highlighting, auto completion, error checking et.al. When creating a software language, generating tooling to support this features can be done using a \emph{language workbench}~\cite{LanguageWorkbench}. The language in question is specified within the language workbench, using a grammar. That grammar is then used to generate the tooling of the language. Many such language workbenches exist, such as Langium~\cite{Langium}, Xtext~\cite{Xtext}, Jetbrains MPS, and Racket.
\section{Domain Specific languages}

View file

@ -553,7 +553,7 @@ The extension automatically uses wildcard declarations in \texttt{applicable to}
\begin{figure}[H]
\begin{center}
\includegraphics[width=\textwidth/2]{figures/EmptyType.png}
\includegraphics[width=\textwidth/2]{figures/UndeclaredRef.png}
\caption{\label{fig:UndeclaredWildcard} Error displayed with usage of undeclared wildcard.}
\end{center}
\end{figure}

View file

@ -8,13 +8,14 @@ The architecture of the solution described in this thesis is illustrated in \fig
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.
In the architecture diagram, circular nodes show data passed into the program sections, and square nodes is a specific section of the program.
In the architecture diagram of Figure~\ref{fig:architecture}, ellipse nodes show data passed into the program sections, and rectangular nodes is a specific section of the program. The architecture is split into seven levels, where each level is a step of the program. The initial step is the proposal definition, the definition can have two different forms, either it is \DSL code, or it can be a JavaScript object using the self hosted in \DSLSH. If we use \DSL, the second step is parsing it using Langium~\cite{Langium}, this parses the raw source code into an AST. If \DSLSH is used, we have to build the prelude, so we have to extract the wildcard definitions from JavaScript source code. At this point the two paths meet at the second step, which is wildcard extraction. At this step, if \DSL was used, the wildcards are extracted from the template. If \DSLSH was used extraction is not needed. In both cases we parse the wildcard type expressions into an AST. The third step is parsing the raw source code with Babel~\cite{Babel}. It is also at this point we parse the users source code into an AST. The fourth step is translating the Babel AST into our own custom tree structure for simpler traversal. Once all data is prepared, the fifth step is matching the user's AST against the \texttt{applicable to} template AST. Once all matches have been found, we transplant the wildcard matches into the \texttt{transform to} template, and insert it back into the users code in step six. We have at this point transformed the users code, the final step seven is generating it back into source code.
\iffalse
\begin{description}
\item[\DSL Code] is the raw text definition of proposals
\item[Self-Hosted Object] is the self-hosted version in \DSLSH format
\item[1. Langium Parser] takes raw \DSL source code, and parses it into a DSL
\item[2. Pre-parser] extracts the wildcards from the raw template definitions
\item[2. Wildcard parsing] extracts the wildcards from the raw template definition in \DSL, and parse
\item[1. Prelude-builder] translates JavaScript prelude into array of wildcard strings
\item[3. Babel] parses the templates and the users source code into an AST
\item[4. Custom Tree Builder] translates the Babel AST structure into our tree structure
@ -22,7 +23,7 @@ In the architecture diagram, circular nodes show data passed into the program se
\item[6. Transformer] performs transformation defined in \texttt{transform to} template to each match of the users AST
\item[7. Generator] generates source code from the transformed user AST
\end{description}
\fi
\begin{figure}[H]
\begin{center}

View file

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View file

@ -1,5 +1,5 @@
\newcommand{\DSL}{JSTQL }
\newcommand{\exProp}{\textbf{optional let to int for declaring numerical literal variables}}
\newcommand{\exProp}{\textbf{declare numerical literal}}
\newcommand{\discardBindings}{Discard Bindings }
\newcommand{\DSLSH}{JSTQL-SH }
\newcommand{\figFull}[1][missing]{Figure \ref{#1}}

View file

@ -314,22 +314,6 @@
url = {https://docs.julialang.org/en/v1/manual/functions/#Function-composition-and-piping}
}
@article{ExpressionOriented,
author = {Bantchev, Boyko B.},
title = {{Putting more meaning in expressions}},
journal = {SIGPLAN Not.},
volume = {33},
number = {9},
pages = {77--83},
year = {1998},
month = sep,
urldate = {2024-05-24},
issn = {0362-1340},
publisher = {Association for Computing Machinery},
url = {https://dl.acm.org/doi/10.1145/290229.290237},
doi = {10.1145/290229.290237}
}
@misc{ecma262,
title = {{ECMAScript{\ifmmode\circledR\else\textregistered\fi} 2025 Language Specification}},
year = {2024},
@ -410,4 +394,49 @@
urldate = {2024-05-29},
note = {[Online; accessed 29. May 2024]},
url = {https://github.com/tc39/how-we-work/blob/main/implement.md#transpiler-implementations}
}
}
@misc{Efftinge2024Feb,
author = {Efftinge, Sven and Spoenemann, Miro},
title = {{Xtext - Language Engineering Made Easy!}},
year = {2024},
month = feb,
urldate = {2024-05-29},
note = {[Online; accessed 29. May 2024]},
url = {https://eclipse.dev/Xtext}
}
@article{ExpressionOriented,
author = {Bantchev, Boyko B.},
title = {{Putting more meaning in expressions}},
journal = {SIGPLAN Not.},
volume = {33},
number = {9},
pages = {77--83},
year = {1998},
month = sep,
urldate = {2024-05-24},
issn = {0362-1340},
publisher = {Association for Computing Machinery},
url = {https://dl.acm.org/doi/10.1145/290229.290237},
doi = {10.1145/290229.290237}
}
@misc{Xtext,
author = {Efftinge, Sven and Spoenemann, Miro},
title = {{Xtext - Language Engineering Made Easy!}},
year = {2024},
month = feb,
urldate = {2024-05-29},
note = {[Online; accessed 29. May 2024]},
url = {https://eclipse.dev/Xtext}
}
@article{LanguageWorkbench,
title = {Evaluating and comparing language workbenches: Existing results and benchmarks for the future},
author = {Erdweg, Sebastian and Van Der Storm, Tijs and V{\"o}lter, Markus and Tratt, Laurence and Bosman, Remi and Cook, William R and Gerritsen, Albert and Hulshout, Angelo and Kelly, Steven and Loh, Alex and others},
journal = {Computer Languages, Systems \& Structures},
volume = {44},
pages = {24--47},
year = {2015},
publisher = {Elsevier}
}