在 JavaScript 中,是否可以根据其他正则表达式来定义正则表达式,从而递归地定义每个正则表达式?
例如,我想使用这些正则表达式(相互定义)来表示 JavaScript 编程语言语法的一小部分:
<functionDefinition> = function <functionName>(<parameterList>){statementList}
<statementList> = (<functionDefinition>| ... other valid statements go here ... ) //a series of JavaScript statements or function definitions
//each of these regular expressions are defined in terms of the others, allowing them to be infinitely nested