Solving string constraints with Regex-dependent functions through transducers with priorities and variables

Author:

Chen Taolue1ORCID,Flores-Lamas Alejandro2,Hague Matthew2ORCID,Han Zhilei3ORCID,Hu Denghang4,Kan Shuanglong5,Lin Anthony W.6ORCID,Rümmer Philipp7ORCID,Wu Zhilin4ORCID

Affiliation:

1. Birkbeck University of London, UK

2. Royal Holloway University of London, UK

3. Tsinghua University, China

4. Institute of Software at Chinese Academy of Sciences, China / University of Chinese Academy of Sciences, China

5. TU Kaiserslautern, Germany

6. TU Kaiserslautern, Germany / MPI-SWS, Germany

7. Uppsala University, Sweden

Abstract

Regular expressions are a classical concept in formal language theory. Regular expressions in programming languages (RegEx) such as JavaScript, feature non-standard semantics of operators (e.g. greedy/lazy Kleene star), as well as additional features such as capturing groups and references. While symbolic execution of programs containing RegExes appeals to string solvers natively supporting important features of RegEx, such a string solver is hitherto missing. In this paper, we propose the first string theory and string solver that natively provides such support. The key idea of our string solver is to introduce a new automata model, called prioritized streaming string transducers (PSST), to formalize the semantics of RegEx-dependent string functions. PSSTs combine priorities, which have previously been introduced in prioritized finite-state automata to capture greedy/lazy semantics, with string variables as in streaming string transducers to model capturing groups. We validate the consistency of the formal semantics with the actual JavaScript semantics by extensive experiments. Furthermore, to solve the string constraints, we show that PSSTs enjoy nice closure and algorithmic properties, in particular, the regularity-preserving property (i.e., pre-images of regular constraints under PSSTs are regular), and introduce a sound sequent calculus that exploits these properties and performs propagation of regular constraints by means of taking post-images or pre-images. Although the satisfiability of the string constraint language is generally undecidable, we show that our approach is complete for the so-called straight-line fragment. We evaluate the performance of our string solver on over 195000 string constraints generated from an open-source RegEx library. The experimental results show the efficacy of our approach, drastically improving the existing methods (via symbolic execution) in both precision and efficiency.

Publisher

Association for Computing Machinery (ACM)

Subject

Safety, Risk, Reliability and Quality,Software

Cited by 12 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Parikh’s Theorem Made Symbolic;Proceedings of the ACM on Programming Languages;2024-01-05

2. Modeling Regex Operators for Solving Regex Crossword Puzzles;Dependable Software Engineering. Theories, Tools, and Applications;2023-12-15

3. String Constraints with Regex-Counting and String-Length Solved More Efficiently;Dependable Software Engineering. Theories, Tools, and Applications;2023-12-15

4. A Closer Look at the Expressive Power of Logics Based on Word Equations;Theory of Computing Systems;2023-12-11

5. Solving String Constraints with Lengths by Stabilization;Proceedings of the ACM on Programming Languages;2023-10-16

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3