BIROn - Birkbeck Institutional Research Online

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

    Chen, Taolue and Hague, M. and Flores-Lamas, A. and Han, Z. and Hu, D. and Kan, S. and Lin, A. and Wu, Z. (2022) Solving string constraints with Regex-dependent functions through transducers with priorities and variables. Proceedings of the ACM on Programming Languages 6 (POPL), pp. 1-31. ISSN 2475-1421.

    [img]
    Preview
    Text
    48294.pdf - Published Version of Record
    Available under License Creative Commons Attribution.

    Download (547kB) | Preview

    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.

    Metadata

    Item Type: Article
    School: Birkbeck Faculties and Schools > Faculty of Science > School of Computing and Mathematical Sciences
    Depositing User: Taolue Chen
    Date Deposited: 24 Aug 2022 15:56
    Last Modified: 09 Aug 2023 12:53
    URI: https://eprints.bbk.ac.uk/id/eprint/48294

    Statistics

    Activity Overview
    6 month trend
    63Downloads
    6 month trend
    111Hits

    Additional statistics are available via IRStats2.

    Archive Staff Only (login required)

    Edit/View Item
    Edit/View Item