Typed and unambiguous pattern matching on strings using regular expressions

Claus Brabrand, Jakob G. Thomsen
<span title="">2010</span> <i title="ACM Press"> <a target="_blank" rel="noopener" href="https://fatcat.wiki/container/mht6wa2vdbg7dn6n6lws4hpzti" style="color: black;">Proceedings of the 12th international ACM SIGPLAN symposium on Principles and practice of declarative programming - PPDP &#39;10</a> </i> &nbsp;
We show how to achieve typed and unambiguous declarative pattern matching on strings using regular expressions extended with a simple recording operator. We give a characterization of ambiguity of regular expressions that leads to a sound and complete static analysis. The analysis is capable of pinpointing all ambiguities in terms of the structure of the regular expression and report shortest ambiguous strings. We also show how pattern matching can be integrated into statically typed
more &raquo; ... languages for deconstructing strings and reproducing typed and structured values. We validate our approach by giving a full implementation of the approach presented in this paper. The resulting tool, reg-exp-rec, adds typed and unambiguous pattern matching to Java in a stand-alone and non-intrusive manner. We evaluate the approach using several realistic examples.
<span class="external-identifiers"> <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/10.1145/1836089.1836120">doi:10.1145/1836089.1836120</a> <a target="_blank" rel="external noopener" href="https://dblp.org/rec/conf/ppdp/BrabrandT10.html">dblp:conf/ppdp/BrabrandT10</a> <a target="_blank" rel="external noopener" href="https://fatcat.wiki/release/6fdrk6nd5ndxdmr6vv2z42byue">fatcat:6fdrk6nd5ndxdmr6vv2z42byue</a> </span>
<a target="_blank" rel="noopener" href="https://web.archive.org/web/20170810025117/http://www.itu.dk/~brabrand/regexp.pdf" title="fulltext PDF download" data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"> <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> Web Archive [PDF] <div class="menu fulltext-thumbnail"> <img src="https://blobs.fatcat.wiki/thumbnail/pdf/a2/bd/a2bddb223b002be85697c7d5abdcf54e29fd29d9.180px.jpg" alt="fulltext thumbnail" loading="lazy"> </div> </button> </a> <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/10.1145/1836089.1836120"> <button class="ui left aligned compact blue labeled icon button serp-button"> <i class="external alternate icon"></i> acm.org </button> </a>