{"title":"Regular Expressions with Backreferences on Multiple Context-Free Languages, and the Closed-Star Condition","authors":"Taisei Nogami, Tachio Terauchi","doi":"arxiv-2406.18918","DOIUrl":null,"url":null,"abstract":"Backreference is a well-known practical extension of regular expressions and\nmost modern programming languages, such as Java, Python, JavaScript and more,\nsupport regular expressions with backreferences (rewb) in their standard\nlibraries for string processing. A difficulty of backreference is\nnon-regularity: unlike some other extensions, backreference strictly enhances\nthe expressive power of regular expressions and thus rewbs can describe\nnon-regular (in fact, even non-context-free) languages. In this paper, we\ninvestigate the expressive power of rewbs by comparing rewbs to multiple\ncontext-free languages (MCFL) and parallel multiple context-free languages\n(PMCFL). First, we prove that the language class of rewbs is a proper subclass\nof unary-PMCFLs. The class of unary-PMCFLs coincides with that of EDT0L\nlanguages, and our result strictly improves the known upper bound of rewbs.\nAdditionally, we show that, however, the language class of rewbs is not\ncontained in that of MCFLs even when restricted to rewbs with only one\ncapturing group and no captured references. Therefore, in general, the\nparallelism seems essential for rewbs. Backed by these results, we define a\nnovel syntactic condition on rewbs that we call closed-star and observe that it\nprovides an upper bound on the number of times a rewb references the same\ncaptured string. The closed-star condition allows dispensing with the\nparallelism: that is, we prove that the language class of closed-star rewbs\nfalls inside the class of unary-MCFLs, which is equivalent to that of EDT0L\nsystems of finite index. Furthermore, as additional evidence for the robustness\nof the condition, we show that the language class of closed-star rewbs also\nfalls inside the class of nonerasing stack languages (NESL).","PeriodicalId":501124,"journal":{"name":"arXiv - CS - Formal Languages and Automata Theory","volume":"37 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-06-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Formal Languages and Automata Theory","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2406.18918","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Backreference is a well-known practical extension of regular expressions and
most modern programming languages, such as Java, Python, JavaScript and more,
support regular expressions with backreferences (rewb) in their standard
libraries for string processing. A difficulty of backreference is
non-regularity: unlike some other extensions, backreference strictly enhances
the expressive power of regular expressions and thus rewbs can describe
non-regular (in fact, even non-context-free) languages. In this paper, we
investigate the expressive power of rewbs by comparing rewbs to multiple
context-free languages (MCFL) and parallel multiple context-free languages
(PMCFL). First, we prove that the language class of rewbs is a proper subclass
of unary-PMCFLs. The class of unary-PMCFLs coincides with that of EDT0L
languages, and our result strictly improves the known upper bound of rewbs.
Additionally, we show that, however, the language class of rewbs is not
contained in that of MCFLs even when restricted to rewbs with only one
capturing group and no captured references. Therefore, in general, the
parallelism seems essential for rewbs. Backed by these results, we define a
novel syntactic condition on rewbs that we call closed-star and observe that it
provides an upper bound on the number of times a rewb references the same
captured string. The closed-star condition allows dispensing with the
parallelism: that is, we prove that the language class of closed-star rewbs
falls inside the class of unary-MCFLs, which is equivalent to that of EDT0L
systems of finite index. Furthermore, as additional evidence for the robustness
of the condition, we show that the language class of closed-star rewbs also
falls inside the class of nonerasing stack languages (NESL).