我刚刚了解到,Regular Grammars
有它们对应Finite State Acceptors
的将对应Regular Expressions
。
是否有等效的转换Context Free Grammars
?据我所知,上下文无关语法可以用Push Down Automata
which 来表示,而后者又对应于什么?
感谢任何能让我摆脱这种想法的人。
我刚刚了解到,Regular Grammars
有它们对应Finite State Acceptors
的将对应Regular Expressions
。
是否有等效的转换Context Free Grammars
?据我所知,上下文无关语法可以用Push Down Automata
which 来表示,而后者又对应于什么?
感谢任何能让我摆脱这种想法的人。
Actually, the answer could still be "Regex".
Modern regex dialects, specifically those that support recursion (like PHP, Perl, .NET, JGSoft and others) can handle context-free languages perfectly.
问题的措辞存在问题,因为它指的是语法而不是语言。
正则语言是一种可以通过联合、连接和闭包操作在集合上定义的语言。正则表达式和正则语法都是表示正则语言的便捷方式。
Context Free Language的问题在于它被定义为Context Free Grammar接受的语言,因此 OP 问题的答案在语言类别定义本身之内。