我得到了一个前缀符号的正则表达式,如下所示:
(r* (r. r| a ( r. b b) (r. c (r* c))) a))
在哪里:
c (for any char c) means "regex accepting the single-character string c"
r. means "regex accepting the empty string"
r/ means "regex accepting nothing"
(r| r1 r2 ...) means "r1 union r2 union ..."
(r. r1 r2 ...) means "r1 concat r2 union ..."
(r* r1) means "r1*"
给定上述正则表达式作为输入,我将如何将其解析为表达式树?它不能只在空格处拆分,因为某些术语中有空格,所以我不确定从哪里开始。