Skip to main content
QUICK REVIEW

[Paper Review] Sequential Circuits from Regular Expressions Revisited

Dogan Ulus|arXiv (Cornell University)|Jan 26, 2018
Formal Methods in VerificationComputer Science5 citations
TL;DR

This paper presents a novel trigger-set algorithm to construct sequential circuits directly from regular expressions, offering a front-wheel-drive update mechanism that pulls state information backward from predecessors—contrasting with traditional automata's forward-propagation. The approach achieves superior performance on highly non-deterministic patterns, outperforming standard NFAs and matching or surpassing DFAs in memory-constrained, pathological cases.

ABSTRACT

We revisit the long-neglected problem of sequential circuit constructions from regular expressions. The class of languages that are recognized by sequential circuits is equivalent to the class of regular languages. This fact is shown in [5] together with an inductive construction technique from regular expressions. In this note, we present an alternative algorithm, called the trigger-set approach, obtained by reversing well-known the follow-set approach to construct automata. We use our algorithm to obtain a regular expression matcher based on sequential circuits. Finally, we report our performance results in comparison with existing automata-based matchers.

Motivation & Objective

  • To address the long-neglected problem of constructing sequential circuits directly from regular expressions for pattern matching.
  • To overcome limitations of backtracking matchers, which can suffer from exponential time complexity on pathological inputs.
  • To explore sequential circuits as an alternative to traditional automata (NFA/DFAs) for regular expression matching, especially in non-deterministic scenarios.
  • To evaluate whether sequential circuits can offer better performance and memory efficiency than existing automata-based matchers like re2’s DFA and NFA engines.
  • To demonstrate that sequential circuits can effectively handle patterns with exponential DFA blowup, where DFAs fail due to state explosion.

Proposed method

  • Proposes a trigger-set approach that reverses the traditional follow-set method used in automaton construction, enabling backward propagation of state reachability.
  • Uses a visitor pattern to traverse the regular expression syntax tree, computing for each position: the expression size, output set, and trigger sets (predecessors that can reach the current state).
  • Constructs a sequential circuit by generating C++ code that implements the state update and output functions based on trigger sets and input vectors.
  • Employs a front-wheel-drive update mechanism: each state is computed independently from its predecessors using current input, contrasting with automata’s rear-wheel-drive forward propagation.
  • Compiles and benchmarks the generated circuit code against re2’s DFA and NFA implementations using standard performance metrics (throughput in MB/s).
  • Uses a fixed 67MB random input sequence and measures minimum execution time over 10 runs to ensure accuracy, with optimizations at -O2 level.

Experimental results

Research questions

  • RQ1Can a trigger-set algorithm be effectively used to construct sequential circuits from regular expressions, providing a viable alternative to automata-based matchers?
  • RQ2How does the performance of sequential circuits compare to re2’s DFA and NFA implementations across diverse regular expression patterns?
  • RQ3Does the front-wheel-drive update mechanism in sequential circuits offer advantages over the rear-wheel-drive propagation in automata, particularly in non-deterministic or pathological cases?
  • RQ4In patterns that cause exponential blowup in DFA construction, does the sequential circuit approach maintain better time and memory efficiency than both DFAs and NFAs?
  • RQ5Can sequential circuits outperform standard NFAs in terms of speed while maintaining comparable or lower memory usage?

Key findings

  • Sequential circuits outperform standard NFAs in all tested cases, including the highly non-deterministic pattern in Table 2, despite similar memory usage.
  • For the pattern in Table 5, which causes exponential blowup in DFA construction, the sequential circuit implementation maintains stable performance (12 MB/s at n=20), while re2’s DFA degrades sharply due to cache limits and fallback to NFA.
  • In the case of a 26-letter sequence (Table 2), the sequential circuit uses only 48 MB, significantly less than re2’s DFA (304 MB) and comparable to its NFA (161 MB), yet achieves better throughput.
  • The sequential circuit approach handles the pathological case of (a?)*a^n more efficiently than the NFA, with memory usage of 115 MB at n=30, compared to 15 MB for NFA and 335 MB for DFA.
  • The trigger-set method enables a direct, efficient code generation pipeline from regular expressions to optimized C++ circuits, avoiding complex automaton construction.
  • The front-wheel-drive update mechanism provides practical advantages in non-deterministic settings, where backward dependency computation avoids the state explosion seen in deterministic automata.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.