有限状态自动机、正则表达式与正则文法详解
1. 有限状态自动机与正则表达式
在处理有限状态自动机(Finite-State Automatons)和正则表达式(Regular Expressions)时,一个重要的操作是移除节点(rip-out-node)。以下是该操作的测试代码:
;; Tests for rip-out-node
(check-equal?
(rip-out-node
'A
'((S ,(singleton-regexp "a") A) (A ,(singleton-regexp "b") B)))
'((S ,(concat-regexp (singleton-regexp "a") (singleton-regexp "b")) B)))
(check-equal?
(rip-out-node
'C
'((S ,(singleton-regexp "a") A) (S ,(singleton-regexp "b") B)
(A ,(singleton-regexp "a") C) (B ,(singleton-regexp "b") C)
(C ,(singleton-regexp "a") D) (C ,(singleton-regexp "b") E)))
'((S ,(singleton-regexp "a") A)
(S ,(singleton-regexp "b") B)
(A ,(concat-regexp (singleton-regexp "a") (singleton-regexp "a")) D)
(
超级会员免费看
订阅专栏 解锁全文
2

被折叠的 条评论
为什么被折叠?



