用平面自动机生成标记器
Generating Tokenizers with Flat Automata
摘要:
我们介绍了自动生成的tokenizer的平面自动机。平面自动机是标准有限自动机的一种简单表示。使用平面表示,自动机可以很容易地构造,组合和打印。由于边界函数的使用,在字符间隔附加到变迁的情况下,平面自动机比标准自动机更紧凑,并且自动机的标准算法更简单。我们给出了自动机标记器构造的标准算法,即使用正则运算、确定性和最小化的构造。我们证明了他们的正确性。这些算法可以处理字符间隔,但并不比处理单个字符的算法复杂。从最终的确定性自动机生成C++代码很容易。所有程序都是用C++实现的,并且是公开的。该实现已在应用和教学中使用。
英文摘要:
We introduce flat automata for automatic generation of tokenizers. Flat automata are a simple representation of standard finite automata. Using the flat representation, automata can be easily constructed, combined and printed. Due to the use of border functions, flat automata are more compact than standard automata in the case where intervals of characters are attached to transitions, and the standard algorithms on automata are simpler. We give the standard algorithms for tokenizer construction with automata, namely construction using regular operations, determinization, and minimization. We prove their correctness. The algorithms work with intervals of characters, but are not more complicated than their counterparts on single characters. It is easy to generate C++ code from the final deterministic automaton. All procedures have been implemented in C++ and are publicly available. The implementation has been used in applications and in teaching.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。