Re: Regular expression string searching & matching

Ben Hanson <jamin.hanson@googlemail.com>
Wed, 7 Mar 2018 12:18:23 -0800 (PST)

          From comp.compilers

Related articles
Regular expression string searching & matching clint.olsen@gmail.com (Clint O) (2018-03-04)
Re: Regular expression string searching & matching jamin.hanson@googlemail.com (Ben Hanson) (2018-03-07)
Re: Regular expression string searching & matching jamin.hanson@googlemail.com (Ben Hanson) (2018-03-07)
Re: Regular expression string searching & matching clint.olsen@gmail.com (Clint O) (2018-03-08)
Re: Regular expression string searching & matching clint.olsen@gmail.com (Clint O) (2018-03-10)
Re: Regular expression string searching & matching jamin.hanson@googlemail.com (Ben Hanson) (2018-03-10)
Re: Regular expression string searching & matching jamin.hanson@googlemail.com (Ben Hanson) (2018-03-11)
Re: Regular expression string searching & matching clint.olsen@gmail.com (Clint O) (2018-03-12)
Re: Regular expression string searching & matching jamin.hanson@googlemail.com (Ben Hanson) (2018-03-12)
[7 later articles]
| List of all articles for this month |

From: Ben Hanson <jamin.hanson@googlemail.com>
Newsgroups: comp.compilers
Date: Wed, 7 Mar 2018 12:18:23 -0800 (PST)
Organization: Compilers Central
References: 18-03-016 18-03-032
Keywords: DFA, lex

I missed your question about non-greedy repeats.


Yes, it is possible. See build_dfa() in generator.hpp from lexertl.


Basically non-greedy transitions are snipped when building the dfa. I build a
regex syntax tree as suggested in the Dragon Book and I keep track of greedy
flags in the tree and that is passed down to partition/equivset.hpp and from
there to the generator. The thing you have to careful about is respecting that
the left side takes priority (i.e. the regex or sub-regex that came first).


Regards,


Ben



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.