DFA、NFA、PDA 和图灵机的现实应用
我现在正在学习计算理论课程。我可以很好地理解这些概念。我能够解决问题。而且,当我向我的导师询问现实世界的应用程序时,他告诉我这些概念在编译器设计中肯定有用且必不可少。但是,至少为了进行有意义的研究,我需要一些关于如何在编码中使用这些概念的解释。
例如,如果我想设计自己的 grep。我将在 C 中使用字符串函数。我不知道如何在编码中使用正则表达式。
同样的情况也适用于图灵机。
如果我想将两个数字相加,为什么我必须遵循这些一元概念。硬件是否实现了这些概念?
I am now taking a course on Theory of Computation. I can understand the concepts well. I can able to solve the problems. And, when I asked my instructor about the real world application, he told me these concepts will be surely useful and essential in compiler design. But, at least to make a meaningful study, I need some explanations on how can I use those concepts it in my coding.
e.g. If I want to design my own grep. I will use string functions in C. I don't know how to use regular expressions there in coding.
Same case applies to Turing machines.
If I want to add two numbers why I have to go by those unary concepts. Does the hardware implement those concepts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这篇文章对 DFA 和 NFA 进行了实际讨论,因为它们适用于高效的正则表达式匹配。它讨论了哪些真实的图书馆使用高效的 Thompson NFA 方法。
图灵机主要作为计算机的定义而实用。如果有人告诉我一种新语言,我可以通过尝试在其中构建图灵机来检查它是否像 C 或 Java 一样强大(不要与易用性混淆)。
This article has a practical discussion of DFA and NFA as they apply to efficient regular expression matching. It discusses which real libraries use the efficient Thompson NFA method.
Turing machines are primarily practical as a definition of a computer. If someone tells me about a new language, I can check whether it's as powerful (not to be confused with ease of use) as say, C or Java by attempting to construct a Turing machine in it.
NFA 和 DFA:这两个在编译器中用于根据源文件中的字符创建标记并将其返回到语法解析器。您可以从 UNIX
lex
和yacc
手册了解更多信息。图灵机:我认为这与其最初的学术目的没有什么不同的用途。
NFA and DFA: These two are used in compilers to create tokens from characters in the source file and return them to the grammar parser. You can learn more from the UNIX
lex
andyacc
manual.Turing Machines: I don't think this has a different use than its original academic purpose.