[英]Finding a regular grammar for a given regular expression?
I am trying to find a regular grammar that generates the language given by the regular expression ((a+b∗c)d)∗
. 我正在尝试找到一个生成由正则表达式
((a+b∗c)d)∗
给出的语言的正则语法。 Is there a general technique I can use to convert regular expressions into regular grammars? 我可以使用一般技术将正则表达式转换为正则语法吗?
It's usually a lot easier to convert a finite automaton for a regular language into a regular grammar than it is to convert a regular expression into a regular grammar. 将常规语言的有限自动机转换为常规语法通常要比将常规表达式转换为常规语法容易得多。 I'd recommend starting off by building an automaton for the regular expression - either manually or by applying Thompson's algorithm to mechanically convert the regex to an automaton - and then doing the conversion from there.
我建议首先为正则表达式构建一个自动机-手动或通过应用Thompson的算法将正则表达式机械地转换为自动机-然后从那里进行转换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.