HackerPapers

arXiv:1907.08837cs.FL

Tagged Deterministic Finite Automata with Lookahead

Ulya Trofimovich

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

This paper extends the work of Laurikari and Kuklewicz on tagged deterministic finite automata (TDFA) in the context of submatch extraction in regular expressions. The main goal of this work is application of TDFA to lexer generators that optimize for speed of the generated code. I suggest a number of practical improvements to Laurikari algorithm; notably, the use of one-symbol lookahead, which results in significant reduction of tag variables and operations on them. Experimental results confirm that lookahead-aware TDFA are considerably faster and usually smaller than baseline TDFA; and they are reasonably close in speed and size to ordinary DFA used for recognition of regular languages. The proposed algorithm can handle repeated submatch and therefore is applicable to full parsing. Furthermore, I examine the problem of disambiguation in the case of leftmost greedy and POSIX policies. I formalize POSIX disambiguation algorithm suggested by Kuklewicz and show that the resulting TDFA are as efficient as Laurikari TDFA or TDFA that use leftmost greedy disambiguation. All discussed algorithms are implemented in the open source lexer generator RE2C.

arXiv comments
32 pages, 23 figures
Journal reference
DOI
Subjects
cs.FLFormal Languages and Automata Theory

On Hacker News

Linked by 1 identifiable commenter in 3 comments across 3 threads, from Jun 2020 to Feb 2024.

Comments linking this paper, per year.

Discussed in comments3 threads

  1. Re2c 1 comment
    • Hm as an re2c user, I always thought that Ragel vs. re2c was a push/pull issue (though re2c flag has a --storable-state flag to generate the push style -- I haven't used it) But now that I look at the example on the front page: http://www.colm.net/open-source/ragel/ action dgt {…

      chubotView on HNParent context

    • Hm I don't really think RE2 is even that influential (unfortunately IMO). Rust is the only new language whose engine borrows its design AFAIK. For example, I was disappointed to learn that Julia uses PCRE. ---- I think backtracking is firmly in the past because it causes too…

      chubotView on HNParent context

  2. Xi-Editor Retrospective 1 comment
    • OK thanks for the clarifications. I responded to BurntSushi and others here: https://lobste.rs/s/fq8uil/aho_corasick https://news.ycombinator.com/item?id=23665341 I don't have experience with captures in re2c, but it's entirely automata-based, and they apparently implement…

      chubotView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.