Out of curiosity, how many people here know how regular expressions are compiled?

I turn to this in my theory class, and I'm curious how many people know what compilation is on a regular basis. I watched online and it seems to me that this is a more archaic topic that I was thinking about.

So, who knew before reading this question that regular expression compilation is done by converting a regular expression into an epsilon-non-deterministic finite state machine? Who doesnโ€™t know what it is?

+7
regex
source share
3 answers

In C, the very simple and elegant little regular expression compiler that Rob Pike wrote about, and Brian Kernigan describes in O'Reilly Beautiful Code in Chapter 1. It is pretty easy to learn. These also include compiler courses: types of tokens can be determined using regular expressions. Therefore, I believe that this knowledge is not very rare.

0
source share

Ok I assume that I will be the first to acknowledge this, although a couple of years ago I took a compiler course and I know the general principle, I think I need to take out the Dragon Book again and read again on this subject if I were asked to write code that does such things.

0
source share

I knew that this had something to do with state machines, but nothing else. Not really an item that I wanted to delve into ... I suspect this is unpleasant under the hood. Not many people on SO, as usual, use regular expressions, never understand how they work.

0
source share

All Articles