正在加载图片...
Converting Regular Expressions Directly to DFAs We may convert a regular expression into a DFA(without creating a NFA first). First we augment the given regular expression by concatenating it with a special symbol # r→(r)# augmented regular expression Then,we create a syntax tree for this augmented regular expression. In this syntax tree,all alphabet symbols(plus and the empty string)in the augmented regular expression will be on the leaves,and all inner nodes will be the operators in that augmented regular expression. Then each alphabet symbol(plus #)will be numbered(position numbers). CS308 Compiler Theory 17Converting Regular Expressions Directly to DFAs • We may convert a regular expression into a DFA (without creating a NFA fi ) rst ). • First we augment the given regular expression by concatenating it with a speci l b l# i a l sym b o l #. r Î (r)# augmented regular expression • Th t t t f thi t d l i Then, we crea te a syn tax tree for this augmen t e d regu lar express ion. • In this syntax tree, all alphabet symbols (plus # and the empty string) in the augmented regular expression will be on the leaves and all inner the augmented regular expression will be on the leaves, and all inner nodes will be the operators in that augmented regular expression. • Then each alphabet symbol (plus #) will be numbered (position Then each alphabet symbol (plus #) will be numbered (position numbers). CS308 Compiler Theory 17
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有