# Certified Split Points for Parallel Lexing: Exact and Modulo Discarded Tokens

DevFeed: [Certified Split Points for Parallel Lexing: Exact and Modulo Discarded Tokens](<https://devfeed.tech/articles/certified-split-points-for-parallel-lexing-exact-and-modulo-discarded-tokens-101582.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2608.03473>)

Author: Nicklas Nidh\\"ogg

Published: 2026-10-27T04:00:00Z

Content type: article

Language: en

Sources: [arXiv: Distributed Computing](<https://devfeed.tech/sources/arxiv-distributed-computing.md>)

Topics: [dfa](<https://devfeed.tech/topics/dfa.md>), [Finite-state machine](<https://devfeed.tech/topics/finite-state-machine.md>)

Tags: [cs-dc](<https://devfeed.tech/tags/cs-dc.md>), [cs-fl](<https://devfeed.tech/tags/cs-fl.md>), [cs-pl](<https://devfeed.tech/tags/cs-pl.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [points](<https://devfeed.tech/tags/points.md>), [split](<https://devfeed.tech/tags/split.md>), [tokenization](<https://devfeed.tech/tags/tokenization.md>), [tokens](<https://devfeed.tech/tags/tokens.md>)

## AI overview

The paper gives two DFA-based conditions for splitting longest-match lexing across chunks without recovering each chunk's entry state. An exact certificate guarantees that every occurrence of a byte begins a token and preserves token kinds and lengths, but strings, comments, or whitespace may eliminate useful certificates. A more permissive, constant-time test guarantees equivalence after removing declared discarded tokens; it is sound but can be incomplete. It recovers newline for a conventional C-like tokenization and tab, newline, and carriage return for JSON, while rejecting newline with unrestricted block comments. Safety is decidable in PSPACE for general token automata and polynomial time for literal vocabularies; unsafe bytes have replayable counterexamples. In tests on 15 token sets, the second condition was exact. The reported single-machine benchmark reached 92.6-95.3% efficiency at eight threads and 3.46-3.94x end-to-end speedup at four threads.

## Source excerpt

arXiv:2608.03473v4 Announce Type: replace-cross Abstract: Table-driven DFA lexing is sequential, since each transition depends on the previous byte's state. Scanning one input in parallel needs each chunk's entry state, which existing methods recover by simulation, speculation, prescanning, or overlap. We give two conditions under which none is needed. For a longest-match scanner restarting from q0 at every token boundary, a byte b is a certified split symbol when no reachable state other than q0 has a b-transition whose target can reach acceptance, and q0 is not re-entrant if it has one. Every occurrence of such a byte in completely tokenizable input begins a token, so chunks starting there reproduce the serial sequence of kinds and lengths. The condition is necessary and sufficient, but one string, comment, or whitespace run can remove every useful certificate. Comments and whitespace are usually discarded, so we weaken the guarantee to equality after deleting a declared discarded set and give a second condition, a precomputed constant-time one-bit test. It is sound but incomplete and more permissive, strictly so on suitable token sets and discarded sets. It recovers newline for a conventional C-like tokenization and tab, newline and carriage return for JSON, and refuses newline where block comments are unrestricted. Safety modulo the discarded set is decidable in PSPACE for every token automaton and in polynomial time for literal vocabularies, and every unsafe byte has a replayable counterexample. On the fifteen token sets studied the second condition is already exact. Splitting at exact certificates in munch reaches 92.6-95.3% parallel efficiency at eight threads on a restricted CPU set and a 512 MiB corpus, and a 3.46-3.94x end-to-end speedup at four threads, on one machine. It turns delimiter-based parallel lexing from a language-specific assumption into a property a compiler checks.