<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Pattern Matching in Pharo</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Aless Hosry</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Vincent Aranega</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Nicolas Anquetil</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stéphane Ducasse</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Univ. Lille, CNRS, Inria, Centrale Lille, UMR 9189 CRIStAL</institution>
          ,
          <addr-line>F-59000 Lille</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Pattern matching is a computational technique used to identify and analyse recurring structures or patterns within data and enable the extraction of meaningful information from the data.In the field of software engineering, pattern matching is often used in applications such as compilers and linters, where the ability to recognise and understand structural patterns in source code is essential for tasks such as optimisation, error detection, and code refactoring, but pattern matching also finds its use for querying deeply recursive structures.Pharo already ofers RBParseTreeSearcher, a powerful Domain Specific Language (DSL) defining its own textual syntax with a focus on matching the Pharo Abstract Syntax Tree (AST).This tool is the base of the Pharo Refactoring Framework.However, RBParseTreeSearcher is dedicated to Pharo AST matching only and cannot perform on other kinds of structures or ASTs.In this paper, we introduce MoTion, a new pattern matcher that works on Pharo objects in the large and that focuses on flexibility and expressiveness, and then we present the syntax of both matcher tools.Finally, we compare the execution speed and the expressiveness of both pattern matchers in the context of AST matching against each other as well as against a pure Pharo request on the AST.MoTion ofers a powerful base for dedicated pattern matchers and matches any kind of Pharo objects, but its genericity implies lower performances than a dedicated solution tailored for a unique usage as RBParseTreeSearcher.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Pattern matching</kwd>
        <kwd>Smalltalk</kwd>
        <kwd>Object-oriented programming</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Pattern matching is a computational technique used to identify and analyse recurring structures
or patterns within data and enables the extraction of meaningful information from the data [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        Pattern matching could vary between string searching or regular expressions, which are
supported in multiple programming languages such as Java, Javascript and C# [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], matching
over trees of objects [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] like ASTs, or object matching using functional programming languages
like Scala [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>
        Such matchers are needed in Pharo for tasks like optimisation [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], by identifying specific
patterns in code defined by developers to reduce resource consumption and enhance performance.
Additionally, matchers can help in error detection by detecting common programming errors
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and applying some code refactoring in order to improve software quality and reliability.
Moreover, pattern matching is reliable for querying deeply recursive structures like nested data
[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] that are very common during software analysis or data exploration in fields like data mining.
      </p>
      <p>
        Based on these requirements, we present in this paper the “RBParseTreeSearcher” matcher
that is already present in Pharo as well as another, more generic matcher that we developed
recently and named “MoTion” [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        The first one is the pattern matcher used by the RefactoringBrowser infrastructure [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], it
allows to define patterns to match them with Pharo source code AST. The RefactoringBrowser
also comes with a RBParseTreeWriter that allows to modify the source code matching a given
pattern, but we will not explore this part here as we are only interested in the pattern matching
capability.
      </p>
      <p>
        The second pattern matcher is MoTion [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], a recently created generic pattern matcher that
allows to express patterns on any set of objects, their classes, and their properties. The focus of
MoTion is the expressiveness of patterns, ofering a large set of functionalities.
      </p>
      <p>In this paper, we present some of the existing approaches and how they difer from each
other in Section 2. Then in sections 3 and 4 we present the syntax of the matchers followed
by examples. The actual comparison takes place in section 5, before concluding the paper in
Section 7.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Pattern matchers characteristics</title>
      <p>Many programming languages ofer pattern-matching libraries. Some of them are GPL (General
Purpose Languages) like in Python, Haskell, Rust and Scala, while others are DSL (Domain
Specific Languages) like with Rascal.</p>
      <p>
        Table 1 presents a list of characteristics we identified in several existing implementations of
pattern matching languages:
Object Matching [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] is the fact of matching any object based on its class and properties. The
expected values of the properties can be themselves patterns to be matched against the
actual value returned when the unary-message is called on real objects.
      </p>
      <p>
        Structural Pattern [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] refers to a pattern that captures and matches the "shape" of a given
object or data using subpatterns.
      </p>
      <p>
        Anonymous Variables [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] refer to tokens that imply the existence of a value without
capturing it.
      </p>
      <p>
        List matching [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] ofers the ability to describe the general shape of a list.
      </p>
      <p>
        Negation [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] consists of specifying a pattern that the data should not match.
Unification [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] consists of using the same variables multiple times in a pattern that all match
the same (repeated) data.
      </p>
      <p>
        Nested Match [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] consists of expressing a pattern about a direct inner object.
Deep Match [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] allows to search for an object in a structure (or hierarchy) without having
to bother about the depth to which the searched object is.
      </p>
      <sec id="sec-2-1">
        <title>Haskell Scala x x x x x x</title>
      </sec>
      <sec id="sec-2-2">
        <title>Python x x x</title>
        <p>
          Javaa
Matching Types
planned
planned
x
x
Recursive Search [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] is similar to Deep Match but assumes a hierarchy of similar objects, or
at least objects that have the same property. For example, one could search for an object
having a specific “child” without knowing at what depth this object, and thus its child,
are.
        </p>
        <p>
          Can yield all results [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ] means that the result contains all data matching the pattern and
not just the first match found.
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>Rust x x x</title>
        <p>x
x
ahttps://dev.java/learn/pattern-matching/
x
x
x
x</p>
        <p>
          Many approaches in the literature applied pattern matching, whether for General Purpose
Programming Languages (GPL) or Domain Specific Programming Languages (DSL) [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]. Table
1, summarises those approaches according to the characteristics described previously in this
section.
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. RBParseTreeSearcher</title>
      <p>In this section, we present the pattern matching language of the Pharo refactoring framework
as implemented in RBParseTreeSearcher. We will first introduce the syntax of the language,
and then we will show diferent usages with Pharo methods of the RBParseTreeSearcher class.</p>
      <sec id="sec-3-1">
        <title>3.1. Syntax</title>
        <p>The syntax of this language relies on specific symbols, allowing to express patterns over any
source code of a Pharo image:
(‘) Back-tick. It is used to match any single node. For example: “‘someName asString” can
match message asString sent to any receiver, disregarding its name. It can match Pharo
source code like “self asString” and “aParam asString”.
(‘#) Literal pattern nodes. To verify that the matched node is a literal, a back-tick can be
followed by the hash sign. “‘#lit size” is an example where ‘#lit can match an
integer 3, a string foo or even a collection such as #(a b c). It will not match “self
asString”.
(‘@) List pattern nodes. Is used to match zero, one or more nodes in the AST. For example,
“|‘@args1 t1 ‘@args2|” returns a successful match with | t1 t2 t3 t4| where
args1 will be empty and args2 matches t2 t3 t4.
(“) Double Back-tick. It is used to perform a recursive search. This implements the deep
match characteristic. It entails searching for patterns not only on the surface level of
the source code, but also examining their internal structure. For example, ““@vars + 1”
matches any selector followed by + 1, additionally, it will internally check if this selector
is already constructed by another selector followed by +1, such as (myNum + 1) + 1 +
5, where the first match of ‘@vars’ is myNum + 1 and the second is myNum found by
the deep match.
(‘.) Statement pattern nodes. To match statements, a developer can use a backtick followed
by a period. Such patterns ‘.Statement1. match a single statement in Pharo such
as “self assert: myVal size equals: 11.” . It can also be combined with the
list pattern (‘@.) to search for a list of successive statements, such as “‘@.statements”
which will successfully match “x := 1. y := 2. z := OrderedCollection new.”.
(‘{ }) Block Pattern Nodes Is a free-form test where, inside the curly braces, one puts a Pharo
block, receiving a node as a parameter and returning a boolean whether this node matches
or not. For example: “‘{:node|node isVariable and: [node isGlobal]} become: nil”
is a pattern that matches a message become: with a nil argument, where the receiver
is a global variable.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Examples</title>
        <p>After describing the syntax and capabilities of Pharo source code matchers over blocks, literals,
statements and so on, we will go through how to use this syntax with a handful of methods
defined in RBParseTreeSearcher in this section. While this paper focuses on matching in Pharo,
it is important to note that the same syntax can be used with a couple of methods implemented
in RBParseTreeWriter to perform some source code transformations.</p>
        <p>Listing 1: Pattern Matching over source code sample
1 searcher := RBParseTreeSearcher new.
2 searcher
3 matches: ’@rcv put’
4 do: [ :aNode :answer | contextDictionary := searcher context ].
5 searcher executeTree: (RBParser parseExpression: ’self put’).</p>
        <p>Listing 1 contains an example of source code pattern matching in Pharo. In line 1, searcher
variable is declared as an RBParseTreeSearcher object. The message #matches:do: is sent
to this variable in line 2 to start the match, where matches: accepts the pattern expressed
using the syntax introduced in the previous section, and do: accepts a block of code that is
executed only when the match succeeds. On success, all matches are stored in a dictionary
(context), where each key represents a part of the pattern, like “@rcv” and the value contains the
matched source code. In cases where the key matches multiple source code fragments, they are
encapsulated in a list and stored in the value in pairs with the convenient key. In this example,
when the block is executed, it enables storing all matches of context in contextDictionary.
To start matching patterns, the developer needs to use method #executeTree: that takes as
input a parsed source code object, such as line 5, using RBParser parseExpression.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. MoTion pattern matcher</title>
      <p>In this section, we are going to present MoTion, a pattern matching language for objects that
relies on specific symbols and a couple of methods to allow matching over objects in a Pharo
image.</p>
      <sec id="sec-4-1">
        <title>4.1. Syntax</title>
        <p>Unlike the previous pattern matching language, MoTion syntax does not have the ability to
explicitly represent the Pharo AST being searched for, except for literals. In simpler terms,
while the old language enables the creation of patterns that directly describe the syntax of
Pharo, MoTion is based on a diferent approach. In MoTion, representations are based on
object types and, if needed, certain methods that correspond to objects in Pharo. This matching
capability extends beyond Pharo language objects and includes any other object like Java objects
represented in Pharo using the FamixJava metamodel.</p>
        <p>Literal matching MoTion is able to match literals (boolean, string, symbols and numbers) by
concretely expressing them like true, 1, #foo and ’Pharo Playground’. In order to
make it more performant, MoTion also allows matching regular expressions for strings.</p>
        <p>For example: Pharo.*ground can match with Pharo Playground.
(%) Object match A basic Object match must first include the type of the Object to match as
defined in Pharo such as Color%{}, RBMessageNode%{} or FamixJavaModel%{}.
(&lt;=&gt;) Properties A match could be more specific, by specifying the type of the object to
match followed by the properties assigned to the specific values. A property represents
a predefined method in the object class only if such methods have a return. For
example: RBComment % {#size &lt;=&gt; 2} is a pattern that could match any comment that
is empty, because the size of comments in Pharo must be bigger than 2 taking into
consideration the double quotation marks.
(&lt;∼ =&gt;) Negation Sometimes, it may be easier to search for objects that match a pattern, which
properties don’t fit specific values, instead of specifying numerous properties. For that
we implemented the negation symbol that helps developers to specify such patterns
easily. For example: RBComment % {#size &lt;∼ =&gt; 2} is a pattern that could match
any comment that is not empty.
(%%) Subclasses This is again a deep match operation. Pattern expression could be more
lfexible by using the double %% to match properties of subclasses, such as RBLiteralNode
%%{#value &lt;=&gt; 1} that could match any object that extends directly or indirectly
RBLiteralNode class.
({.}) Lists More than one property could be specified for the match, by encapsulating all
properties in a list after defining the type. For example: RBLiteralNode %%{#value
&lt;=&gt; 1. #sourceText &lt;=&gt; #’a text here’ } which allows the usage of value
and #sourceText.
(@) WildCards Wildcards are used to match a property associated to any value. The
importance of wildcards in MoTion is their ability to save and return such values to be
treated in following steps using Pharo. For example: RBLiteralNode %%{#value &lt;=&gt;
#’@anyValue’}, where @anyValue could be anything associated to #value.
Composed patterns Pattern searching may require searching for complex structures, for that,
MoTion allows declaring patterns constructed also of subpatterns, such as: RBBlockNode
%{ #statements &lt;=&gt; RBValueNode %% { #value &lt;=&gt; 2 } } where #statements
is associated to another subpattern.</p>
        <p>Block Matcher they are used to generate new matchers dependently on the current object
being matched and/or variables captured during the matching process, such as: ObjectA
%{ #lint &lt;=&gt; [ :collection| collection includes: 4] onCollection }
can match objA lint: #(1 2 3 4 5 6 7) because the list contains 4 as described
by the block inside the pattern.</p>
        <p>Conditional Matcher they are used to write complex conditional matchers dependent on the
current object being matched and/or variables captured during the matching process
To make it easier to represent advanced patterns, we developed the MoTion path, which is used
solely to express properties within a pattern, allowing the direct access of children’s properties
instead of defining subpatterns in patterns.
(&gt;) Composed path MoTion paths are composed out of multiple properties as descendent
children, which means they are not methods declared in the same class, but they are properties
of the return type object. For example: RBMessageNode % { #’selector&gt;value’
&lt;=&gt; #ifTrue:ifFalse: } #selector is a property of RBMessageNode that returns
an object of type RBSelectorNode, which in turn has a property named value. This
helps expressing patterns in a more flexible way, by accessing directly a children’s
property. It is important to note, composed path allows accessing at the same time only one
direct children, but the path could be extended to as many subchildren layers as the
developer needs, like: definedClasses&gt;methodDict&gt;ast&gt;allChildren.
(_) Anonymous property Anonymous properties usage is when the developer doesn’t know
what is the exact name of the property, or when she/he wants to access a descendant
children without caring about the predecessors. In this case, multiple matches could result
if multiple properties have the same descendant children. For example: RBMessageNode
% { #’_&gt;parent’ &lt;=&gt; @anyParent } could return matches for receiver&gt;parent
and selector&gt;parent as both have parent as a property.
(*) Recursive search It enables searching for the same property in many children layers,
specially when the developer doesn’t know what is the depth of such children to
precise it in a composed path. For example: RBMethodNode % #’children*’ &lt;=&gt;
RBMessageNode % #’selector&gt;value’ &lt;=&gt; #ifTrue:ifFalse: which
allows searching recursively for all properties named children in diferent descendent
layers, to match any one with selector #if True:ifFalse:.
(as:) Matcher save The main purpose of this matcher is to encapsulate patterns and
subpatterns into variables, in order to be able to retrieve their values after a successful
match. For example: RBMethodNode % #’children*’ &lt;=&gt; RBMessageNode %
#’selector&gt;value’ &lt;=&gt; #ifTrue:ifFalse: as: #MyMessageNode where
#MyMessageNode contains matching objects of type RBMessageNode.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Examples</title>
        <p>Listing 2 is an example of MoTion and how we can use it to match a package. Lines 1 to 8
contain the pattern defined using MoTion syntax. Line 9 is matching this pattern with Talents
package as it is required in MoTion using #match: message. The return type of this match
is a MatchingContext which contains isMatch of type Boolean, and matchingContexts
which contains a list of a bindings dictionary that in turn contains the wildcards (since their
values are unknown) as keys, and the matched objects as values. However, MoTion also provides
a way to retrieve only the bindings of specific wildcards such as in line 10. The return type of
collectedBindings is a list of bindings, each of which has a dictionary of keys and values. If
multiple matches exist, this means that multiple bindings are returned in the list.</p>
        <p>As for the structure of the pattern, between lines 1 and 8 , it’s a pattern of type RPackage
which properties are encapsulated in a list. The first property #classes is associated to a
wildcard @allClasses (line 2), to store all the classes of the matched package and retrieve
them in line 10 using message #collectBindings:for:. The second property is constructed
of a MoTion path, as we are interested in methodDict of definedClasses which in turn
encapsulates a subpattern.</p>
        <p>Listing 2: Pattern Matching over source code sample
1 pattern := RPackage % {
2 #classes &lt;=&gt; #’@allClasses’.
3 #’definedClasses&gt;methodDict’ &lt;=&gt; CompiledMethod % {
4 #’ast&gt;allChildren’ &lt;=&gt; RBMessageNode % {
5 #’selector&gt;value’ &lt;=&gt; #ifTrue:ifFalse:
6 }
7 }
8 }.
9 pattern match: #Talents asPackage.
10 collectedBindings := pattern collectBindings: {#allClasses} for: (#Talents asPackage).</p>
        <p>As a summary, listing 2 is a an example of a pattern to be matched with any package in Pharo,
which methods contain the selector #ifTrue:ifFalse.</p>
        <p>We mentioned earlier that MoTion can match objects, and we are using it to match Java, XML
ans SQL Objects parsed in Pharo. Listing 3 is an example of how we can use it to retrieve XML
nodes based on their attribute name and value, which cannot be done using RBParseTreeSearcher
syntax.</p>
        <p>Listing 3: Pattern Matching over source code sample
1 XMLNodeList % {
2 #’_&gt;attributes’ &lt;=&gt; XMLAttribute % {
3 #’name’ &lt;=&gt; #’Field’ .
4 #’value’ &lt;=&gt; #’myButton1’.
5 }
6 }</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Comparison</title>
      <p>By leveraging MoTion’s syntax, users can specify complex patterns to match objects based
on various criteria, as we chose MoTion syntax to be expressed declaratively. In terms of
capabilities, MoTion has been impacted by other matchers like the ones stated in 2 in addition
to RBParseTreeSearcher such as deep search and anonymous variables. Since both matchers
have some common capabilities, we decided to perform a comparison of matching using the
same Pharo 11 image for both of them. We took some basic source code templates, some of
which are search rules implemented as examples in the rewrite tool.</p>
      <sec id="sec-5-1">
        <title>5.1. Syntax and Expressiveness</title>
        <p>• The first example, shown in Listing 4, checks if the source code has a selector #ifTrue:ifFalse:.</p>
        <p>With RBParseTreeSearcher, specifying patterns to detect the receiver and the list of
arguments inside the blocks is mandatory, while in MoTion, this specification could be
skipped as the developer is only interested in knowing if the selector is invoked in this
code or not.
• Patterns of the second example in Listing 5, are inspired by the third rule of the rewriter
tool, whose purpose is to check if nil exists in ifNil to remove it by applying a
transformation rule. For this rule, the RBParseTreeSearcher pattern is more eficient as
it is able to precisely position nil inside ifNil:. This cannot be done by MoTion, as it
cannot precisely determine the nil position in the used blocks.
• The third example, shown in Listing 6, is inspired by rule 8 of the rewriter tool, which
consists of matching a select: method that contains a receiver followed by not, to be
replaced in a later stage by reject:. Again, the precision of not position is mandatory
in this example, which is possible by RBParseTreeSearcher as it is able to express the
possible existence of temporary variables and statement lists, followed by not positioned
at the end inside the block. While that is not possible in MoTion, as the properties
declared inside the pattern and associated with some values or subpatterns, do not take
into consideration their order.</p>
        <p>Listing 4: Match #if True:ifFalse:
3
4 "-- MoTion --"
5 RBMessageNode % {
6 #’selector&gt;value’ &lt;=&gt; #ifTrue:ifFalse:
7 }
1 "-- RBParseTreeSearcher --"
2 ‘@receiver ifNil: [ nil ] ifNotNil: ‘@arg
3
4 "-- MoTion --"
5 RBMessageNode % {
6 #’selector&gt;value’ &lt;=&gt;#ifNil:ifNotNil:.
7 #’arguments&gt;body&gt;statements&gt;value’ &lt;=&gt; nil
8 }.</p>
        <p>Listing 5: Remove unessecary #ifNil</p>
        <p>Listing 6: Replace #select: by #reject:</p>
      </sec>
      <sec id="sec-5-2">
        <title>5.2. Matching speed</title>
        <p>recognised for its superior speed compared to MoTion as it is dedicated to matching only Pharo
ASTs. It is optimised for this only, while MoTion is entirely generic and can match any object at
any depth, implying more computation and thus more time to execute.</p>
      </sec>
      <sec id="sec-5-3">
        <title>5.3. Matching characteristics</title>
        <p>After comparing the speed of match for both languages, we list in Table 3 the characteristics
explained in section 2 and if they are applied for each one of them: Based on both comparisons,
it is evident that RBParseTreeSearcher exhibits superior performance compared to MoTion,
despite the latter being a more generic pattern matching language.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Future work</title>
      <p>MoTion lacks for the moment two important features: a debugger and a pattern generator.
Currently, we use MoTion to extract source code to do software analysis for cross-language
applications, but the expressiveness of such patterns is error-prone, especially while precising
the properties of a MoTion path, which sometimes leads us to lose time while expressing such
patterns. At the moment, we are employing a simple technique that involves minimising MoTion
paths and starting to determine whether or not we have found a match. However, a debugger
will be able to automate this process and address the incorrectness of such paths and what
properties may be incorrect, thus making it faster and more efective for developers to use.
Additionally, we intend to develop a pattern generator that will enable developers—particularly
those who are unfamiliar with MoTion—to provide it with the source code they want it to search
for. MoTion will then be able to automatically generate patterns that represent such source
code, enabling developers to match it against the packages or models they want to search for.</p>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusion</title>
      <p>To conclude, we present in this paper two pattern matchers in Pharo. The first one,
RBParseTreeSearcher syntax, is able to match Pharo AST and has the ability to apply transformations
using the rewriter tool. The second one, MoTion, implemented recently for matching over
objects, including Pharo ASTs, given their types and properties. Both matchers were compared,
and the experiment has shown a faster performance for RBParseTreeSearcher over the same
patterns, being more specific. However, we also realised that, given the flexibility of the syntax
of MoTion, a higher ability to match objects, disregarding their complexity, and is able to support
structural patterns, lists, object matching, deep matching, negation, and many other
characteristics compared with other tools implemented in the literature by diferent programming
languages.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Hills</surname>
          </string-name>
          ,
          <article-title>Navigating the wordpress plugin landscape</article-title>
          ,
          <source>in: 2016 IEEE 24th International Conference on Program Comprehension (ICPC)</source>
          , IEEE,
          <year>2016</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>10</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>J. E.</given-names>
            <surname>Friedl</surname>
          </string-name>
          ,
          <article-title>Mastering regular expressions, "</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <source>Inc."</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>C. M.</given-names>
            <surname>Hofmann</surname>
          </string-name>
          ,
          <string-name>
            <surname>M. J. O'Donnell</surname>
          </string-name>
          ,
          <article-title>Pattern matching in trees</article-title>
          ,
          <source>Journal of the ACM (JACM) 29</source>
          (
          <year>1982</year>
          )
          <fpage>68</fpage>
          -
          <lpage>95</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>B.</given-names>
            <surname>Emir</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Odersky</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Williams</surname>
          </string-name>
          ,
          <article-title>Matching objects with patterns</article-title>
          ,
          <source>in: ECOOP 2007-ObjectOriented Programming: 21st European Conference</source>
          , Berlin, Germany,
          <source>July 30-August 3</source>
          ,
          <year>2007</year>
          . Proceedings 21, Springer,
          <year>2007</year>
          , pp.
          <fpage>273</fpage>
          -
          <lpage>298</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>D. C.</given-names>
            <surname>Atkinson</surname>
          </string-name>
          , W. G. Griswold,
          <article-title>Efective pattern matching of source code using abstract syntax patterns</article-title>
          ,
          <source>Software: Practice and Experience</source>
          <volume>36</volume>
          (
          <year>2006</year>
          )
          <fpage>413</fpage>
          -
          <lpage>447</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Hills</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Klint</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. J.</given-names>
            <surname>Vinju</surname>
          </string-name>
          ,
          <article-title>Program analysis scenarios in rascal</article-title>
          , in: Rewriting Logic and Its Applications: 9th International Workshop, WRLA 2012,
          <article-title>Held as a Satellite Event of ETAPS</article-title>
          , Tallinn, Estonia, March
          <volume>24</volume>
          -25,
          <year>2012</year>
          ,
          <source>Revised Selected Papers 9</source>
          , Springer,
          <year>2012</year>
          , pp.
          <fpage>10</fpage>
          -
          <lpage>30</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>[7] MoTion, Motion, ???? Https://github.com/forBlindReview/MoTion.</mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>N.</given-names>
            <surname>Anquetil</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Campero</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ducasse</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.-P.</given-names>
            <surname>Sandoval</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Tesone</surname>
          </string-name>
          ,
          <article-title>Transformation-based refactorings: a first analysis</article-title>
          ,
          <source>in: IWST</source>
          22-International Workshop of Smalltalk Technologies,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>D.</given-names>
            <surname>Di</surname>
          </string-name>
          <string-name>
            <surname>Ruscio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Eramo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Pierantonio</surname>
          </string-name>
          , Model transformations,
          <year>2012</year>
          , pp.
          <fpage>91</fpage>
          -
          <lpage>136</lpage>
          . doi:
          <volume>10</volume>
          . 1007/978-3-
          <fpage>642</fpage>
          -30982-
          <issue>3</issue>
          _
          <fpage>4</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>L.</given-names>
            <surname>George</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Wider</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Scheidgen</surname>
          </string-name>
          ,
          <article-title>Type-safe model transformation languages as internal DSLs in scala</article-title>
          ,
          <source>in: Theory and Practice of Model Transformations: 5th International Conference, ICMT 2012</source>
          , Prague, Czech Republic, May
          <volume>28</volume>
          -29,
          <year>2012</year>
          . Proceedings 5, Springer,
          <year>2012</year>
          , pp.
          <fpage>160</fpage>
          -
          <lpage>175</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>C.</given-names>
            <surname>Schmitt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kuckuk</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Köstler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Hannig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Teich</surname>
          </string-name>
          ,
          <article-title>An evaluation of domain-specific language technologies for code generation</article-title>
          ,
          <source>in: 2014 14th International Conference on Computational Science and Its Applications</source>
          , IEEE,
          <year>2014</year>
          , pp.
          <fpage>18</fpage>
          -
          <lpage>26</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>C.</given-names>
            <surname>Kirchner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kopetz</surname>
          </string-name>
          , P.-E. Moreau,
          <article-title>Anti-pattern matching</article-title>
          ,
          <source>in: Programming Languages and Systems: 16th European Symposium on Programming, ESOP</source>
          <year>2007</year>
          ,
          <article-title>Held as Part of the Joint European Conferences on Theory and Practics of Software, ETAPS 2007</article-title>
          , Braga, Portugal, March 24-April 1,
          <year>2007</year>
          . Proceedings 16, Springer,
          <year>2007</year>
          , pp.
          <fpage>110</fpage>
          -
          <lpage>124</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Rascal</surname>
          </string-name>
          , Rascal, ???? Https://www.rascal-mpl.org/docs/Rascal/Patterns/.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>P.</given-names>
            <surname>Klint</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Van Der Storm</surname>
          </string-name>
          , J. Vinju,
          <article-title>Rascal: A domain specific language for source code analysis and manipulation</article-title>
          , in: 2009
          <source>Ninth IEEE International Working Conference on Source Code Analysis and Manipulation</source>
          , IEEE,
          <year>2009</year>
          , pp.
          <fpage>168</fpage>
          -
          <lpage>177</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>