Skip to content
Snippets Groups Projects
Commit f3308f01 authored by Jueun Park's avatar Jueun Park
Browse files

Update

parent 2aa0c7ed
Branches
No related tags found
No related merge requests found
Pipeline #11517 passed with warnings
......@@ -45,9 +45,9 @@ Before it starts with the parameter inference, the random testing generator of S
During the implementation phase of parameter inference, RAG was beneficial at writing codes. At writing codes for parser and backtransformation, attributes could not be applicated, because the functional parts change the structure of AST, which conflicts to the definition of attribute and also in JastAdd. So, it could not be realized that attributes can be practical. But, following attributes and features of JastAdd were helpful to construct the generators and implement them:
\begin{itemize}
\item As long as a returned type can be called or storable in primitive way, the syntax in RAG is reduced with an equlas sign and simpler than in common programming language. Therefore, the source codes are compact. To compare how RAG could be implemented effectively, see the implementation of an attribute in this work in Listing 5.3 and how this attribute is defined in common Java description in Listing 5.4.
\item As long as a returning value can be called or storable in primitive way, the syntax in RAG is reduced with an equlas sign and simpler than in common programming language. Therefore, the source codes are compact. To compare how RAG could be implemented effectively, see the implementation of an attribute in this work in Listing 5.3 and how this attribute is defined in common Java description in Listing 5.4.
\item To iterate all paths available in OpenAPI, an inherited attribute facilitated the writing effort. Paths Objects are child nodes of OpenAPI Object, so, all that should have been done was only two lines of code instead of writing an extra for loop. See Listing 5.5.
\item Collection attributes
\item As its name, Reference Attribute Grammar, every AST node can be referenced by an attribute. For instance, with an collection attribute. A reference defined in Listing 4.1 contains only a String variable named Ref, it still could provide its Object like in Listing 5.6.
\end{itemize}
\begin{lstlisting}[language=JRAG,label={lst:attribute-infParam},caption={Attribute InferredParameter.value()}]
......@@ -60,13 +60,29 @@ public String InferredParameter.value() {
}
\end{lstlisting}
\begin{lstlisting}[language=JRAG,label={lst:java-infParam},caption={InferredParameter.value() in Java}]
\begin{lstlisting}[language=JRAG,label={lst:inherited},caption={Inherited Attribute in Paths Object}]
inh boolean PathsObject.inferUrl();
eq OpenAPIObject.getPathsObject(int i).inferUrl(){
...
}
\end{lstlisting}
\begin{lstlisting}[language=JRAG,label={lst:coll-param},caption={Collection Attribute in Parameter Object}]
coll List<ParameterTuple> OpenAPIObject.parameterTuples() [new ArrayList<>()] root OpenAPIObject;
ParameterTuple contributes this
to OpenAPIObject.parameterTuples();
...
syn ParameterObject ParameterOb.parameterObject();
eq ParameterObject.parameterObject() = this;
eq ParameterReference.parameterObject() {
for( ParameterTuple t : root().parameterTuples() ){
if( t.getKey().equals(getRef().substring(getRef().lastIndexOf("/")+1, getRef().length())) )
return t.getParameterOb().parameterObject();
}
return new ParameterObject();
}
\end{lstlisting}
% Result
% Future work
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment