Recursive State Machine Guided Graph Folding for Context-Free Language Reachability
Yuxiang Lei, Yulei Sui, Shin Hwei Tan, Qirun Zhang
Abstract
Context-free language reachability (CFL-reachability) is a fundamental framework for program analysis. A large variety of static analyses can be formulated as CFL-reachability problems, which determines whether specific source-sink pairs in an edge-labeled graph are connected by a reachable path, i.e., a path whose edge labels form a string accepted by the given CFL. Computing CFL-reachability is expensive. The fastest algorithm exhibits a slightly subcubic time complexity with respect to the input graph size. Improving the scalability of CFL-reachability is of practical interest, but reducing the time complexity is inherently difficult.
In this paper, we focus on improving the scalability of CFL-reachability from a more practical perspectivereducing the input graph size. Our idea arises from the existence of trivial edges, i.e., edges that do not affect any reachable path in CFL-reachability. We observe that two nodes joined by trivial edges can be folded-by merging the two nodes with all the edges joining them removed-without affecting the CFL-reachability result. By studying the characteristic of the recursive state machines (RSMs), an alternative form of CFLs, we propose an approach to identify foldable node pairs without the need to verify the underlying reachable paths (which is equivalent to solving the CFL-reachability problem). In particular, given a CFL-reachability problem instance with an input graph and an RSM, based on the correspondence between paths in and state transitions in RSM, we propose a graph folding principle, which can determine whether two adjacent nodes are foldable by examining only their incoming and outgoing edges.
On top of the graph folding principle, we propose an efficient graph folding algorithm Gf. The time complexity of Gf is linear with respect to the number of nodes in the input graph. Our evaluations on two clients (alias analysis and value-flow analysis) show that Gf significantly accelerates RSM/CFL-reachability by reducing the input graph size. On average, for value-flow analysis, Gf reduces 60.96% of nodes and 42.67% of edges of the input graphs, obtaining a speedup of 4.65× and a memory usage reduction of 57.35%. For alias analysis, Gf reduces 38.93% of nodes and 35.61% of edges of the input graphs, obtaining a speedup of 3.21× and a memory usage reduction of 65.19%.
• Theory of computation → Grammars and context-free languages.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext e36b7b72-beb2-4939-a719-910c1d72ca44Cited by top-tier papers4
- Two Birds with One Stone: Multi-Derivation for Fast Context-Free Language Reachability AnalysisChenghang Shi, Haofeng Li, Yulei Sui, Jie Lu et al.ASE 2023 · 6 citations
- Boosting the Performance of Alias-Aware IFDS Analysis with CFL-Based Environment TransformersHaofeng Li, Chenghang Shi, Jie Lu, Lian Li et al.OOPSLA 2024 · 6 citations
- Fast Graph Simplification for Path-Sensitive Typestate Analysis through Tempo-Spatial Multi-Point SlicingXiao Cheng, Jiawei Ren, Yulei SuiFSE 2024 · 4 citations
- Efficient Abstract Interpretation via Selective WideningJiawei Wang, Xiao Cheng, Yulei SuiOOPSLA 2025
Builds on3
- Flow2Vec: value-flow-based precise code embeddingYulei Sui, Xiao Cheng, Guanqin Zhang, Haoyu WangOOPSLA 2020 · 94 citations
- Fast graph simplification for interleaved Dyck-reachabilityYuanbo Li, Qirun Zhang, Thomas W. RepsPLDI 2020 · 30 citations
- Taming transitive redundancy for context-free language reachabilityYuxiang Lei, Yulei Sui, Shuo Ding, Qirun ZhangOOPSLA 2022 · 16 citations
Related papers
- Iterative-Epoch Online Cycle Elimination for Context-Free Language ReachabilityPei Xu, Yuxiang Lei, Yulei Sui, Jingling XueOOPSLA 2024 · 3 citations
- Context-Free Language Reachability via Skewed TabulationYuxiang Lei, Camille Bossut, Yulei Sui, Qirun ZhangPLDI 2024 · 5 citations
- Better Not Together: Staged Solving for Context-Free Language ReachabilityChenghang Shi, Haofeng Li, Jie Lu, Lian LiISSTA 2024 · 2 citations
- Fast Client-Driven CFL-Reachability via Regularization-Based Graph SimplificationChenghang Shi, Dongjie He, Haofeng Li, Jie Lu et al.OOPSLA 2025 · 2 citations
- Context-Free Language Reachability via Efficient Relation ChainingChenghang Shi, Haofeng Li, Jie Lu, Lian LiOOPSLA 2026
