Wednesday 15 May 2013

c++ - regex NFA for undefined order of tokens -


I am creating a simple regex parser that creates NFA. It is not a string parser but it is used to validate the string. From this article, I have found basic information based on my needs. Or operator (token1 | token2) and end operator (token1, token 2).

The next operator has thrown me a blind ball, mainly because, and I have searched many articles, there is no simple regex expression. Such operator.

I have to shoot something like this (token 3, token 1, token 2). One should be present, but the order is not important.

I do not need a rajx expression for this, I have to know how I can apply it in NFA. How to link nodes together.

Please, no more technical answers. I am still taking my head around the pan / pebbles and apicillon nodes.

Repeat the question again. How does one implement a non-specific order of matching NFA token? When I mention the above nodes, I was not asking for the code, I was talking about the whole circle and using the various tutorials, making panini construction. Possible solution:

Pen and paper hands and when I wrote a red black tree for the first time, I missed back. I could do color code nodes, while moving through NFA, a bucket is filled with each node which can be accessed from the present. With an optional node, (a | b), the pointer is added to both nodes, if the input is one or the other, then one step occurs and the bucket is filled again I will call it 'alternate node' Maybe 'green' if I change color, it changes into 'strict node', perhaps 'amber', I do not let the parsers go out on any condition, but leaves the bucket empty.

The following DFA states (code) .. J and Last state Z . I do not think that in a more efficient way, it is basically to calculate all orders in DFA or NFA.

  A ---- 1 - & gt; B2 - & gt; E-3 - & gt; Z \ \ - 3 - & gt; F2 - & gt; Z \ --- 2 - & gt; C-1 - & gt; G3 - & gt; Z \ \ - 3 - & gt; H-1 - & gt; Z \ - 3 - & gt; D-1 - & gt; I - 2 - & gt; Z \ - 2 - & gt; J - 1 - & gt; Z    

No comments:

Post a Comment