【文件属性】:
文件名称:tknz:基于 DFA 的标记器引擎
文件大小:25KB
文件格式:ZIP
更新时间:2021-06-12 13:45:00
Java
知乎
基于 DFA 的标记器
基本原理
作为计算理论学生,您通常会学习编写确定性有限状态自动机来表示常规语法和识别常规语言。 然而,当使用生产级词法分析器时,语法的编写方式截然不同:使用某种正则表达式。 tknz通过提供一种专门要求编写确定性有限状态自动机的语言,缩小了这两种方法在常规语法上的差距。
例如,对于实数:
典型的正则表达式:
/[1-9][0-9]*( \. [0-9]+)?/
tknz 语法,更接近您作为计算类理论初学者所学的内容:
Automaton Number
start state first-digit
with "123456789" goto next-digits
stop state next-digits
with "0123456789" goto next-digits
with "." goto dot
【文件预览】:
tknz-master
----bundle.bat(62B)
----build.bat(257B)
----configure.bat(427B)
----configure(227B)
----manifest.txt(22B)
----LICENSE(1KB)
----test()
--------grammar00.tkn(115B)
--------grammar01.tkn(205B)
--------input04-01.txt(124B)
--------grammar03.tkn(92B)
--------grammar04.tkn(763B)
--------grammar02.tkn(500B)
----README.md(4KB)
----tknz()
--------core()
--------parser()
--------exec()
--------grammar()
----.gitignore(236B)