WO2010018710A1 - 有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム - Google Patents

有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム Download PDF

Info

Publication number
WO2010018710A1
WO2010018710A1 PCT/JP2009/060985 JP2009060985W WO2010018710A1 WO 2010018710 A1 WO2010018710 A1 WO 2010018710A1 JP 2009060985 W JP2009060985 W JP 2009060985W WO 2010018710 A1 WO2010018710 A1 WO 2010018710A1
Authority
WO
WIPO (PCT)
Prior art keywords
character
regular expression
nfa
conversion
characters
Prior art date
Application number
PCT/JP2009/060985
Other languages
English (en)
French (fr)
Inventor
顕弘 元木
Original Assignee
日本電気株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電気株式会社 filed Critical 日本電気株式会社
Priority to JP2010524682A priority Critical patent/JP5321589B2/ja
Publication of WO2010018710A1 publication Critical patent/WO2010018710A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Definitions

  • the present invention relates to the generation of a finite automaton circuit for character string matching, and more particularly to the generation of a finite automaton circuit for character string matching for processing a plurality of characters simultaneously.
  • Non-Patent Literature 2 a non-deterministic finite automaton (NFA) is directly circuitized as a hardware circuit, and a reconfigurable device such as an FPGA (Field Programmable Gate Array).
  • NFA non-deterministic finite automaton
  • FPGA Field Programmable Gate Array
  • Pattern matching using such hardware generates an NFA that represents a search target pattern described using a regular expression, and converts the generated NFA directly into a hardware circuit, thereby improving the parallel operation characteristics. High speed processing is possible.
  • the hardware circuit is configured by converting the basic pattern constituting the regular expression into a predetermined circuit. All regular expressions are “character” “c” (matches character c itself), “concatenation” “XY” (regular expressions X and Y appear in this order), “select” “X
  • the regular expression includes an expression indicating that the designated character appears repeatedly for the designated number of times (hereinafter, “expression indicating that the designated character appears repeatedly for the designated number of times” is referred to as “repeated regular expression”).
  • the regular expression “c ⁇ N ⁇ ” represents N repetitions of the character c.
  • Non-patent Document 4 In 105 to 107, the regular expression “c ⁇ N ⁇ ” is not expanded into a combination of four basic patterns of regular expressions, and the NFA circuit corresponding to the regular expression “c ⁇ N ⁇ ” is reduced with less hardware resources. A method of configuring is disclosed.
  • the search throughput is a value proportional to the operating frequency.
  • multi-character NFA a technique for improving the search throughput by increasing the number of characters (number of bytes) that can be processed per clock cycle.
  • Non-Patent Document 3 discloses a method of generating a multi-character NFA from a single-character NFA (hereinafter referred to as a single-character NFA) using matrix operation. However, in order to apply the method disclosed in Non-Patent Document 3, it is necessary to expand the designated regular expression into the above-described four basic patterns in advance.
  • the first problem is that a regular expression “c ⁇ N ⁇ is used in order to create an NFA (multi-character NFA) that accepts a plurality of characters as a transition condition using the method disclosed in Non-Patent Document 3. ”Must be expanded into combinations of four basic patterns in advance, and if the number of character repetitions increases, the number of states of one-character NFA or multi-character NFA, or the size of the NFA description matrix described in Non-Patent Document 3 increases. It will be.
  • the Snort rule set which is one of the intrusion detection systems, includes a regular expression such as “ ⁇ sCREATE ⁇ s [ ⁇ ⁇ n] ⁇ 1024 ⁇ ”. This expression indicates that a character other than a line feed character repeats 1024 times after a space character, a character string “CREATE”, and a space character follow.
  • FIG. 20 shows a regular expression “BCDA ⁇ 93 ⁇ STU” (“BCD” followed by 93 repetitions of the letter A followed by “STU” in the method described in Non-Patent Document 3. )
  • BCD BCD
  • STU STU
  • FIG. 21 is a conceptual diagram showing an NFA conversion matrix expressing the same regular expression by the same method as FIG. In FIG. 21, an element whose element value is not described is 0.
  • the numbers in circles indicate the NFA state number.
  • the numbers on the left side and the numbers on the upper side of the NFA conversion matrix S in FIG. 21 indicate the state numbers in one character NFA.
  • the i row and j column of the NFA conversion matrix represents a character set as a transition condition from state i to state j in 1 character NFA.
  • element “A” in 3 rows and 4 columns represents state 3 to state 4 of 1 character NFA.
  • the transition condition “A” to is shown.
  • the transition from the state 3 to the state 96 with the character “A” is repeated 93 times.
  • the portion corresponding to 93 repetitions of the transition by the character “A” from state 3 to state 96 in the single character NFA of FIG. 20 is “A” from 3 rows 4 columns to 95 rows 96 columns. Is a portion in which 93 are arranged diagonally. As a whole, the NFA conversion matrix S has 100 rows and 100 columns.
  • the number of NFA states and the size of the NFA conversion matrix greatly depend on the number of repetitions of the designated character of the repeated regular expression. If the number of repetitions is larger than the number of states other than the regular expression, the number of NFA states and the size of the NFA description matrix are O (N), where N is the number of repetitions of the regular expression.
  • N the number of repetitions of the regular expression.
  • the amount of calculation for multiplying square matrices of size D ⁇ D is O (D ⁇ 3)
  • the amount of calculation required for the operation of the NFA conversion matrix rapidly increases. Increase.
  • NFA multi-character NFA
  • the second problem is that when an NFA that accepts a plurality of characters as a transition condition (multi-character NFA) is generated, it is difficult to grasp the position where the repeated regular expression exists.
  • a third problem is that it is difficult to use an efficient NFA circuit configuration as an NFA circuit corresponding to the repeated regular expression “c ⁇ N ⁇ ” in an NFA circuit capable of processing a plurality of characters in one clock cycle.
  • an NFA circuit capable of processing a plurality of characters in one clock cycle, in order to use an efficient NFA circuit configuration as an NFA circuit configuration corresponding to the repeated regular expression “c ⁇ N ⁇ ”, an NFA that accepts a plurality of characters as a transition condition ( When the multi-character NFA) is generated, it is necessary to specify a state corresponding to the repeated regular expression.
  • an NFA circuit capable of processing a plurality of characters in one clock cycle using an efficient NFA circuit configuration corresponding to the repeated regular expression “c ⁇ N ⁇ ”, for example, the NFA circuit configuration disclosed in Non-Patent Document 4. It becomes difficult to construct.
  • Each of the problems described above is not limited to NFA, but can also occur in DFA.
  • the object of the present invention is to change the number of states of a single-character FA or multi-character FA that expresses a regular expression or the number of states from a single-character FA to a multi-character
  • An object of the present invention is to provide a finite automaton generation device, a pattern matching device, a finite automaton circuit generation method, and a program thereof that can reduce the amount of calculation at the time of conversion to FA.
  • a finite automaton generation device converts an input regular expression into a finite automaton (FA) having a transition condition of one character unit, and has a finite state having a transition condition of one character unit.
  • FA finite automaton
  • a finite automaton generation device that converts from an automaton to a finite automaton having a transition condition of an arbitrary number of characters specified, an input device that accepts input of the number of motion characters related to the regular expression and the transition condition of the finite automaton, and a regular expression
  • a one-character FA generating unit that generates the first one-character FA based on the character, and a state transition representing a repeated regular expression included in the first one-character FA based on the number of motion characters is replaced with a state transition for multi-character conversion
  • the multi-character conversion pre-processing unit that generates the second single-character FA and the second single-character FA converted by the multi-character conversion pre-processing unit
  • a multi-character FA conversion unit that generates a first multi-character FA based on the number of characters, and a state transition for multi-character conversion corresponding to a repeated regular expression in the first multi-character FA generated by the multi-character FA conversion unit
  • a multi-character conversion post-processing unit that generates a second multi
  • a pattern matching apparatus is a pattern matching apparatus that performs pattern matching processing on input data, and outputs a data input unit that receives input data and a result of the pattern matching processing. 6.
  • a finite automaton according to claim 5, further comprising: a result output unit, and a pattern matching unit that performs pattern matching processing on input data between the data input unit and the result output unit. It is specified based on the circuit description generated by the generation device.
  • a finite automaton generation method converts an input regular expression into a finite automaton (FA) having a transition condition of one character unit, and has a finite state having a transition condition of one character unit.
  • a finite automaton generation method for performing conversion from an automaton to a finite automaton having a transition condition of an arbitrary number of characters specified by receiving an input of a regular expression and the number of motion characters related to the regular expression, and a first based on the regular expression 1 character FA is generated, and a state transition representing a repeated regular expression included in the first character FA is replaced with a state transition for multi-character conversion based on the number of motion characters to generate a second character FA.
  • the first multi-character FA is generated from the second single-character FA based on the number of operating characters, and the multi-character conversion state corresponding to the repeated regular expression in the first multi-character FA And generates a second multi-character FA replacing transferred to state transitions represents a repeating regular expression behavior character units.
  • a finite automaton generating program converts an input regular expression into a finite automaton (FA) having a transition condition of one character unit, and has a finite state having a transition condition of one character unit.
  • FA finite automaton
  • the computer that controls the finite automaton generation device that performs the conversion from the automaton to the finite automaton that has the transition condition of any number of characters specified by the computer, the process of accepting the input of the regular expression and the number of motion characters related to the regular expression, A process for generating the first one-character FA based on the state transition, a state transition representing a repeated regular expression included in the first one-character FA based on the number of motion characters is replaced with a state transition for multi-character conversion, Processing for generating one character FA, processing for generating a first multi-character FA based on the number of motion characters from the second one-character FA, and a first multi-sentence A process of generating a second multi-character FA by replacing the state transition for multi-character conversion corresponding to the repeated regular expression in the FA with a state transition representing a repeated regular expression in units of the number of operating characters. .
  • the present invention replaces a state transition corresponding to a repeated regular expression with a state transition composed of a minimum number of states without expanding the state transitions to the number of repetitions of basic elements.
  • Is converted to a multi-character FA so that the number of states of a single-character FA expressing a regular expression, the multi-character FA, and the conversion from a single-character FA to a multi-character FA The amount of computation can be reduced.
  • the finite automaton generation device 1 converts an input regular expression into a finite automaton (FA) having a transition condition of one character unit, and designates from the finite automaton having the transition condition of one character unit Is converted to a finite automaton having a transition condition of an arbitrary number of characters, an input device 11 that receives input of the number of operating characters related to the regular expression and the transition condition of the finite automaton, and a first based on the regular expression
  • a one-character FA generating unit 21 that generates one-character FA, and a state transition representing a repeated regular expression included in the first one-character FA based on the number of motion characters is replaced with a state transition for multi-character conversion,
  • the first multi-character conversion pre-processing unit 22 that generates one-character FA and the second single character FA converted by the
  • a multi-character FA conversion unit 23 that generates a character FA and a multi-character conversion state transition corresponding to a repetitive regular expression in the first multi-character FA generated by the multi-character FA conversion unit.
  • a multi-character conversion post-processing unit 24 that generates a second multi-character FA in place of a state transition representing an expression.
  • the multi-character conversion pre-processing unit 22 includes the number of repetitions determined by the number of operation characters for a state transition representing a repetition regular expression in which the number of repetitions of the repetition regular expression is greater than the number of operation characters included in the first single character FA.
  • a second single character FA is generated by substituting with a state transition representing a repeated regular expression.
  • the multi-character conversion post-processing unit 24 replaces the state transition for multi-character conversion corresponding to the repeated regular expression included in the first multi-character FA with a state transition representing a repeated regular expression in units of the number of operating characters.
  • the conversion procedure is determined by the number of repeated characters and the number of action characters of the repeated regular expression.
  • a regular expression is expressed by converting from a single character unit FA to a multiple character unit FA after replacing the state transition with a minimum number of states. It is possible to reduce the number of states of the FA in units of characters and the number of FAs in units of multiple characters, and the amount of calculation when converting from a single character FA to a multi-character FA. This will be described in detail below.
  • the processing for the NFA is described (only “NFA” can be replaced with “DFA” and can be applied to DFA).
  • the “first one-character FA” is “one-character NFA”.
  • “Second one-character FA” is described as “one-character NFA for conversion”
  • “first multi-character FA” is described as “multi-character NFA for conversion”
  • “second multi-character FA” is described as “multi-character NFA”. is doing.
  • “state transition for multi-character conversion” is a process described as an iterative process of steps S201 to S209 in FIG.
  • FIG. 1 is a block diagram showing a configuration of a finite automaton generating apparatus 1 according to the first embodiment of the present invention.
  • the finite automaton generation device 1 is a central part of a computer device composed of an input device 11 such as a keyboard, a CPU, a RAM, an OS, and the like. It comprises a storage device 14 composed of a volatile storage means and an output device 13 such as a display device or a printer device.
  • the storage device 14 includes a repeated regular expression storage unit 31, a one-character NFA storage unit 32, a conversion one-character NFA storage unit 33, a conversion multi-character NFA storage unit 34, and a multi-character NFA storage unit 35.
  • the repeated regular expression storage unit 31 holds information on repeated regular expressions included in the regular expression read by the one-character NFA generating unit 21 from the input device 11, and includes a multi-character NFA conversion pre-processing unit 22 and a multi-character NFA converted post-process. Referenced in the multi-character NFA conversion process in the section 24.
  • the 1-character NFA storage unit 32 holds the 1-character NFA converted from the regular expression read by the 1-character NFA generating unit 21 from the input device 11.
  • the conversion 1-character NFA storage unit 33 holds the conversion 1-character NFA converted from the 1-character NFA stored in the 1-character NFA storage unit 32 by the multi-character NFA conversion pre-processing unit 22.
  • the conversion multi-character NFA storage unit 34 is a multi-character NFA obtained by converting the multi-character NFA conversion unit 23 from the conversion one-character NFA held in the conversion one-character NFA storage unit 33. Holds the character NFA.
  • the multi-character NFA storage unit 35 holds the final multi-character NFA converted by the multi-character NFA conversion post-processing unit 24 from the conversion multi-character NFA stored in the conversion multi-character NFA storage unit 34.
  • the data structure of the NFA held in the 1-character NFA storage unit 32, the conversion 1-character NFA storage unit 33, the conversion multi-character NFA storage unit 34, and the multi-character NFA storage unit 35 is a data structure capable of expressing NFA. Any data structure may be used, and specific examples include a data structure such as a list structure and a matrix format.
  • the data processing device 12 has various functions such as a 1-character NFA generation unit 21, a multi-character NFA conversion pre-processing unit 22, a multi-character NFA conversion unit 23, a multi-character NFA conversion post-processing unit 24, and an HDL conversion unit 25. Execute. These functional units are realized as programs executed by the data processing device 12, and media on which these programs are recorded are also included in the scope of patents.
  • the 1-character NFA generating unit 21 reads a regular expression from the input device 11, converts the read regular expression into a 1-character NFA, stores the converted 1-character NFA in a 1-character NFA storage unit 32, and performs multi-character NFA conversion
  • the pre-processing unit 22 is notified that the conversion to one-character NFA has been completed.
  • the repeated regular expression “c ⁇ N ⁇ ” is not expanded into “concatenation of N characters“ c ”” which is a basic pattern of the regular expression.
  • the repeated regular expression included in the regular expression and the state number of one-character NFA corresponding to the repeated regular expression are stored in the repeated regular expression storage unit 31 as a repeated regular expression information list.
  • the multi-character NFA conversion pre-processing unit 22 reads the number of operating characters from the input device 11.
  • the number of action characters is the length of a character (column) that becomes a transition condition of the generated multi-character NFA.
  • the number of action characters is represented by M.
  • M is a natural number of 2 or more. It becomes.
  • the multi-character NFA conversion pre-processing unit 22 When the multi-character NFA conversion pre-processing unit 22 receives the notification of conversion completion from the one-character NFA generating unit 21, the multi-character NFA conversion pre-processing unit 22 reads the one-character NFA in which the regular expression “c ⁇ N ⁇ ” is not expanded repeatedly from the one-character NFA storage unit 32. Reading, replacing a repeated regular expression included in one character NFA with a state transition for multi-character conversion, storing the generated one-character NFA as one character NFA for conversion in the one-character NFA storage unit 33 for conversion, and multi-character NFA The conversion unit 23 is notified that the conversion to the conversion single-character NFA has been completed. When replacing a repeated regular expression included in one character NFA with a state transition for multi-character conversion, information on the state transition for multi-character conversion replaced in the repeated regular expression information list held in the repeated regular expression storage unit 31 Add
  • the multi-character NFA conversion unit 23 reads the number of operating characters from the input device 11. The meaning of the number of motion characters is the same as that described in the description of the multi-character NFA conversion preprocessing unit 22.
  • the multi-character NFA conversion unit 23 receives the notification of conversion completion from the multi-character NFA conversion pre-processing unit 22, the multi-character NFA conversion unit 23 uses the method disclosed in Non-Patent Document 3 and holds it in the conversion one-character NFA storage unit 33.
  • a multi-character NFA is generated from the converted single-character NFA, the generated multi-character NFA is stored as a multi-character NFA for conversion in the multi-character NFA storage unit for conversion 34, and converted to the multi-character NFA conversion post-processing unit 24 Notify completion of conversion to multi-character NFA.
  • the multi-character NFA conversion post-processing unit 24 reads the number of operating characters from the input device 11.
  • the meaning of the number of action characters is the same as the meaning already described in the description of the multi-character NFA conversion preprocessing unit 22.
  • the multi-character NFA conversion post-processing unit 24 receives the notification of conversion completion from the multi-character NFA conversion unit 23, the multi-character NFA conversion post-processing unit 24, based on the repeated regular expression information list held in the repeated regular expression storage unit 31, The state transition for multi-character conversion included in the multi-character NFA for conversion held in 34 is replaced with a repeated regular expression in units of M characters, the generated multi-character NFA is stored in the multi-character NFA storage unit 35, and HDL The conversion unit 25 is notified that the conversion to the multi-character NFA has been completed.
  • the multi-character NFA stored in the multi-character NFA storage unit 35 When the HDL conversion unit 25 receives the notification of conversion completion from the multi-character NFA conversion post-processing unit 24, the multi-character NFA stored in the multi-character NFA storage unit 35, the state of the NFA, transition between states, transition conditions Analyzing information, etc., converting each state into a register, converting transition conditions into a character (column) comparator, connecting each register according to the transition between states, and hardware description languages such as Verilog and VHDL It is converted into a circuit description indicating the NFA circuit described in (HDL; Hardware Description Language) and output to the output device 13.
  • HDL Hardware Description Language
  • a net list or the like used for expressing the connection relation of LSI and FPGA circuit components in text may be used.
  • Non-Patent Document 4 is used as an NFA circuit corresponding to a repeated regular expression in units of M characters included in the multi-character NFA held in the multi-character NFA storage unit 35.
  • Non-Patent Document 2, Non-Patent Document 3, and Non-Patent Document 4 disclose a method of converting a multi-character NFA other than a portion related to state transition corresponding to a repeated regular expression into an NFA circuit.
  • the 1-character NFA generating unit 21 reads a regular expression from the input device 11, converts the read regular expression into a 1-character NFA, stores the converted 1-character NFA in a 1-character NFA storage unit 32, and performs multi-character NFA conversion
  • the pre-processing unit 22 is notified that the conversion to one-character NFA has been completed.
  • the repeated regular expression “c ⁇ N ⁇ ” is not expanded into “concatenation of N characters“ c ”” which is a basic pattern of the regular expression.
  • the repeated regular expression included in the regular expression and the state number of 1-character NFA corresponding to the repeated regular expression are held in the repeated regular expression storage unit 31 as repeated regular expression information.
  • conversion from a regular expression to a one-character NFA can be divided into two processes: a conversion from a regular expression to a syntax tree (Syntax Tree) and a conversion from a syntax tree to an NFA (for example, non-patent literature). 1 p.327).
  • the one-character NFA generating unit 21 expands the repeated regular expression “c ⁇ N ⁇ ” into “a concatenation of N characters“ c ”” which is a basic pattern of regular expressions.
  • FIG. 2 shows p.
  • FIG. 11 is a conceptual diagram illustrating a result of converting a regular expression “BCD ((A ⁇ 100 ⁇
  • a node of the syntax tree when a node of the syntax tree is a character, it corresponds to each character in the regular expression, a node “•” in the syntax tree is a concatenation of regular expressions, and a node “
  • the node “*” corresponds to the metacharacter of the regular expression meaning zero or more repetitions.
  • the node “repetitive regular expression” is a node corresponding to the repetitive regular expression, and has a repetitive character and a repetitive number as child elements.
  • the node “repetitive regular expression” in FIG. 2 corresponds to the repeated regular expression “A ⁇ 100 ⁇ ” included in “BCD ((A ⁇ 100 ⁇
  • a ⁇ 100 ⁇ means that the repeated character “A” is repeated “100 times”.
  • FIG. 3 is a transition diagram showing a one-character NFA obtained from the syntax tree shown in FIG.
  • Non-Patent Document 1 Non-Patent Document 2, and the like are disclosed as general methods for converting a syntax tree into a one-character NFA. For this reason, only the conversion for the node representing the “repetitive regular expression” in the syntax tree will be described here.
  • a node representing “repetitive regular expression” in the syntax tree is converted into one state transition indicating a repeated regular expression in one character NFA.
  • the information about the repeated regular expression is used as a repeated regular expression information list to repeat the regular expression storage unit 31. To store.
  • FIG. 4 is a table showing an example of a repeated regular expression information list stored in the repeated regular expression storage unit 31 shown in FIG.
  • Each entry in the list includes a repeated character of a repeated regular expression, the number of repeated repeated regular expressions, and a start number of state transition with one character NFA corresponding to the repeated regular expression.
  • Entry for the repeated regular expression information list is prepared for the number of repeated regular expressions in the regular expression.
  • the number of entries in the repeated regular expression information list is only one because the repeated regular expression is “A ⁇ 100 ⁇ ”. Is 1, and the content of the entry of the repeated regular expression information list corresponding to “A ⁇ 100 ⁇ ” is based on the node information indicating “repeated regular expression” of the syntax tree, the repeated character is “A”, and the number of repetitions. Becomes 100.
  • the state transition corresponding to “A ⁇ 100 ⁇ ” is the state transition corresponding to state 7 to state 8, and the entry of the repeated regular expression information list corresponding to “A ⁇ 100 ⁇ ” 7 is stored in the start state number.
  • the above is the operation of the one-character NFA generating unit 21.
  • FIG. 5 is a flowchart showing the operation of the multi-character NFA conversion pre-processing unit 22.
  • the number M of operating characters is read from the input device 11 (step S101).
  • all repeated regular expressions included in one-character NFA are replaced with multi-character conversion state transitions (step S102).
  • FIG. 6 is a flowchart showing details of the replacement of the repeated regular expression shown in step S102 of FIG. 5 with the state transition for multi-character conversion. Since information related to all repeated regular expressions included in one character NFA is registered in the repeated regular expression information list by the one character NFA generating unit 21, conversion processing is performed for all repeated regular expressions included in one character NFA. Is equivalent to processing all entries in the repeated regular expression information list.
  • step S102 processing is performed for all entries in the repeated regular expression information list (repeated processing in steps S201 to S209).
  • the repeated regular expression information list at the start of step S102 is as shown in FIG.
  • Steps S202 to S208 are processing relating to each entry in the repeated regular expression information list.
  • the repeated character of the i-th entry of the repeated regular expression information list is Ai
  • the number of repetitions is Ci
  • the start state number is Si.
  • the processes in steps S202 to S208 are performed for the first entry.
  • step S203 the number of repetitions Ci and the number of action characters M are compared.
  • the repeated regular expression starting from the start state number Si is replaced with the state transition of M + 1 characters Ai.
  • the 1-character NFA stored in the 1-character NFA storage unit 32 at the time when the multi-character NFA conversion pre-processing unit 22 starts processing is as shown in FIG.
  • the “repeated regular expression starting from the start state number Si” is a state transition corresponding to the solid line frame “A ⁇ 100 ⁇ ” including the states 7 and 8 in FIG. is there.
  • the number of the second state from the beginning of the state transition is stored as the start state number of the first entry in the repeated regular expression information list.
  • step S203 in FIG. 6 the number of repetitions Ci is compared with the number M of operating characters. If Ci ⁇ M, the repeated regular expression is expanded as it is into a concatenation of Ci characters Ai (step S206). In the case of Ci ⁇ M, the repeated regular expression with the number of repetitions Ci and the concatenation of the Ci characters Ai are completely equivalent, and there is no need to perform post-processing in the multi-character generation post-processing unit 124. The corresponding entry is deleted (step S207).
  • step S102 Since the regular expression “BCD ((A ⁇ 100 ⁇
  • FIG. 7 is a transition diagram showing the one-character NFA for conversion obtained when the process up to step S102 in FIG. 5 is completed.
  • FIG. 8 is a conceptual diagram showing a repeated regular expression information list held in the repeated regular expression storage unit 31 at the time of completion up to step S102 in FIG.
  • step S103 the one-character NFA for conversion is converted into a one-character NFA that does not include an ⁇ transition.
  • a method of converting an NFA including an ⁇ transition into an NFA not including an ⁇ transition is generally called an ⁇ -closure ( ⁇ -closure), and is disclosed in Non-Patent Document 1 or the like.
  • FIG. 9 is a transition diagram showing the conversion one-character NFA stored in the conversion one-character NFA storage unit 33 after performing the ⁇ -closure process in step S103 of FIG.
  • the state transition corresponding to the repeated regular expression “A ⁇ 100 ⁇ ” is a state transition in the solid line frame from state 3 ⁇ 4 ⁇ 5 ⁇ 6 ⁇ 7 ⁇ 8, and the state number is changed. Therefore, the regular expression information list is repeatedly updated.
  • FIG. 10 is a conceptual diagram showing a repeated regular expression information list held in the repeated regular expression storage unit 31 at the time of completion up to step S103 in FIG.
  • step S103 the conversion to the one-character NFA that does not include the ⁇ transition is performed by the next multi-character NFA converting unit 23 that converts the one-character NFA (for conversion) to the multi-character NFA (for conversion). This is because the method of Patent Document 3 needs to give an NFA that does not include an ⁇ transition as an input. If the multi-character NFA conversion unit 23 uses a multi-character NFA conversion method that can give an NFA including an ⁇ transition as an input, the conversion process to a one-character NFA that does not include an ⁇ transition in step S103 is unnecessary. .
  • one character NFA for conversion does not include an ⁇ transition in step S103.
  • ⁇ -closure to convert to character NFA is performed, there is no restriction on the timing to perform ⁇ -closure.
  • ⁇ -closure is performed immediately after one character NFA generating unit 21 generates one character NFA from a regular expression.
  • a one-character NFA that does not include an ⁇ transition may be input to the multi-character NFA conversion preprocessing unit 22.
  • intermediate data in the process of generating the conversion one-character NFA in step S102 or step S103 is also stored in the conversion one-character NFA storage unit 33, and when the processing up to step S103 is completed, The converted one-character NFA storage unit 33 stores the completed one-character NFA for conversion. Thus, the processing of the multi-character NFA conversion preprocessing unit 22 is completed.
  • the multi-character NFA conversion unit 23 reads the number of operating characters from the input device 11.
  • the meaning of the number of motion characters is the same as that described in the description of the multi-character NFA conversion preprocessing unit 22.
  • the multi-character conversion unit 123 uses the conversion method based on the NFA description matrix disclosed in Non-Patent Document 3. Then, a multi-character NFA is generated from the single-character NFA for conversion stored in the single-character NFA storage unit 33 for conversion, and the generated multi-character NFA is converted into the multi-character NFA for conversion in the multi-character NFA storage unit 34 for conversion.
  • the multi-character NFA conversion post-processing unit 24 is notified that the conversion to the conversion multi-character NFA has been completed.
  • FIG. 11 is a transition diagram showing the conversion multi-character NFA generated by the conversion process by the multi-character NFA conversion unit 23 shown in FIG. 1 and stored in the conversion multi-character NFA storage unit 34.
  • any method used by the multi-character NFA conversion unit 23 for conversion from (for conversion) 1-character NFA to (for conversion) multi-character NFA any method can be used as long as the state number does not change before and after conversion. Can also be used. “No change in the state number” means that, for example, when converting from one character unit NFA (FIG. 9) to four character unit NFA (FIG. 11), the state number is changed from state 2 to one character unit NFA. When the character string “DESA” is changed by 4 characters, the state 4 is reached. Even in the case of a 4-character NFA, the state of the transition destination and the source of the transition is such that the state transitions from the state 2 to the state 4 under the transition condition “DESA”. It means that the number does not change.
  • the method using the NFA description matrix disclosed in Non-Patent Document 3 is one of the conversion methods satisfying this condition.
  • the multi-character NFA conversion post-processing unit 24 first reads the number of operating characters from the input device 11. The meaning of the number of motion characters is the same as that described in the description of the multi-character NFA conversion preprocessing unit 22. After that, when a notification of conversion completion is received from the multi-character NFA conversion unit 23, the state transition for multi-character conversion included in the multi-character NFA for conversion held in the multi-character NFA storage unit 34 for conversion is displayed in units of M characters. Performs processing to replace with regular expression repeatedly.
  • FIG. 12 shows the state transition for multi-character conversion included in the multi-character NFA for conversion stored in the multi-character NFA storage unit 34 for conversion by the multi-character NFA conversion post-processing unit 24 shown in FIG. It is a flowchart which shows the detail of the process replaced with the regular expression of a unit.
  • the repeated regular expressions that need to be post-processed by the multi-character NFA conversion post-processing unit 24 are all repeated regular expressions having the number of repeated characters larger than M, and the repeated regular expression information list held in the repeated regular expression storage unit 31 It corresponds to 1: 1 without excess and deficiency. This is because a repeated regular expression that does not need to be post-processed by the multi-character NFA conversion post-processing unit 24 is a repeated regular expression having a number of repeated characters of M or less. Such a repeated regular expression is represented in steps S206 to S207 in FIG. This is because it has been repeatedly deleted from the regular expression information list.
  • the multi-character NFA conversion post-processing unit 24 performs processing for all entries in the repeated regular expression information list (repetition of steps S301 to S308).
  • the steps between Steps S302 to S307 are processing for each entry in the regular expression information list repeatedly.
  • the contents of the repeated regular expression information list held in the repeated regular expression storage unit 31 at the time when the multi-character NFA conversion post-processing unit 24 is started are as shown in FIG.
  • the operation of the flowchart of FIG. 12 will be described by taking the process for the first entry in the repeated regular expression information list as an example.
  • the multi-character NFA conversion post-processing unit 24 creates a copy of M states starting from the state number Si corresponding to the repeated regular expression (step S303).
  • FIG. 13 is a transition diagram showing the multi-character NFA at the time when the copy state shown in step S303 of FIG. 12 is generated.
  • the copies of states 4, 5, 6, and 7 are represented as states 4-2, 5-2, 6-2, and 7-2, respectively.
  • the multi-character NFA conversion post-processing unit 24 moves the transition in the output direction to the created copy state. Specifically, if there is a state transition whose state 4 is the transition source, the transition source of the state transition is changed to state 4-2 (step S304). This is performed for all the state transitions in which state 4 is the transition source. All the state transitions in which the states 5, 6, and 7 are transition sources are also changed so that the states 5-2, 6-2, and 7-2 are transition sources, respectively.
  • FIG. 14 is a transition diagram showing the multi-character NFA at the time when the processing up to step S304 in FIG. 12 is completed.
  • the state transition that transitions from state 6 to state 8 under the transition condition “AASE” is changed to the state transition that transitions from state 6-2 to state 8 under the transition condition “AASE” as shown in FIG. Is done.
  • the state transition that transitions from state 7 to state 5 under the transition condition “ASAA” is changed to the state transition that transitions under state “ASAA” from state 7-2 to state 5 as shown in FIG. Even if the transition destination state is any one of states 4, 5, 6, and 7, the transition destination is not changed.
  • the multi-character NFA conversion post-processing unit 24 assigns a reference number to the state corresponding to the repeated regular expression and its copy state (step S305). Specifically, serial numbers from 1 to M are assigned in order from the state number Si to M states starting from the state number Si corresponding to the repeated regular expression. A serial number from Ci-M to Ci-1 is assigned in order from the copy corresponding to the state number Si to the M copies corresponding to the M states starting from the state number Si corresponding to the repeated regular expression.
  • FIG. 15 is a conceptual diagram illustrating the operation of step S305 in FIG. 12 for the first entry in the repeated regular expression information list, which is used to describe the operation of the multi-character NFA conversion post-processing unit 24.
  • the M copies corresponding to the M states starting from the state number Si corresponding to the repeated regular expression are the states 4-2, 5-2, 6-2, and 7-2 (the states corresponding to the state 4).
  • the multi-character NFA conversion post-processing unit 24 assigns the transition based on the repeated regular expression in units of M characters based on the pseudo number (step S306).
  • M is a pair of M states starting from the state number Si corresponding to the repeated regular expression and M states that are copies of the M states, which have the same remainder when the reference number is divided by M.
  • a state transition representing a repeated regular expression in units of M characters is created so that the copy state becomes a transition destination between the states constituting each pair.
  • the repeated regular expression in units of M characters includes M characters Ci, and the number of repetitions is (copy number reference number ⁇ original state reference number) ⁇ M.
  • M states starting from state number Si corresponding to repeated regular expression are states 4
  • M states that are copies are states 4-2, 5- 2, 6-2 and 7-2.
  • states 4, 5, 6, and 7 and states 4-2, 5-2, 6-2, and 7-2 having the same remainder are selected, there are four state pairs as indicated by arrows in FIG. Created. Between these pairs, states representing repeated regular expressions in units of M characters, with the state 4, 5, 6, 7 side being the transition source and the state 4-2, 5-2, 6-2, 7-2 side being the transition destination Create a transition.
  • the number of repetitions of the regular expression is 23, and the repeated character of the repeated regular expression is “AAAA” as in the case of the state 4 ⁇ the state 5-2.
  • FIG. 16 is a transition diagram showing the repeated regular expression in M character units assigned in step S306 of FIG. 12 added to the multi-character NFA of FIG.
  • “AAAA ⁇ 24 ⁇ ” indicates that the transition condition “AAAA” is repeated 24 times.
  • intermediate data in the process of generating the multi-character NFA is also stored in the multi-character NFA storage unit 35, and when the processing is completed up to step S308, the multi-character NFA storage unit 35 is completed. Stored multi-character NFA.
  • the HDL conversion unit 25 When the HDL conversion unit 25 receives the notification of conversion completion from the multi-character NFA conversion post-processing unit 24, the multi-character NFA stored in the multi-character NFA storage unit 35, the state of the NFA, transition between states, transition conditions Analyzing information, etc., converting each state into a register, converting transition conditions into a character (column) comparator, connecting each register according to the transition between states, and hardware description languages such as Verilog and VHDL It is converted into a circuit description indicating the NFA circuit described in (HDL: “Hardware” Description “Language”) and output to the output device 13.
  • HDL “Hardware” Description “Language”
  • the NFA circuit configuration disclosed in Non-Patent Document 4 is used as an NFA circuit corresponding to a repeated regular expression in units of M characters included in the multi-character NFA held in the multi-character NFA storage unit 35.
  • a repeated regular expression “AAAA ⁇ 24 ⁇ ” in units of four characters FIG.
  • An NFA circuit corresponding to the expression can be configured.
  • FIG. 17 is a conceptual diagram showing an example of an NFA circuit configuration for constructing a repeated regular expression “AAAA ⁇ 24 ⁇ ” in units of four characters.
  • Non-Patent Document 2, Non-Patent Document 3, and Non-Patent Document 4 disclose a method of converting a multi-character NFA other than a portion related to state transition corresponding to a repeated regular expression into an NFA circuit.
  • the finite automaton generation device 1 receives an input of a regular expression and the number M of operating characters related to the regular expression (FIG. 5: step S101), and performs a first operation based on the input regular expression.
  • One 1-character FA is generated.
  • the state transition representing the repeated regular expression in units of M characters included in the first one character FA is replaced with the state transition for multi-character conversion, and the second one character FA is generated (FIG. 5: Steps S102 to S103).
  • a first multi-character FA is generated from the second single character FA based on the number M of operating characters described above, and for multi-character conversion corresponding to a repeated regular expression in the first multi-character FA.
  • the second multi-character FA is generated by replacing the state transition with a state transition representing a repeated regular expression in units of M characters (FIG. 12: Steps S301 to S308).
  • the process of outputting the second multi-character FA is based on a predetermined calculation rule based on the state transition for multi-character conversion corresponding to the repeated regular expression included in the first multi-character FA.
  • it is a process of replacing with a state transition representing a recurring regular expression of the number M of operation characters.
  • the process of converting the first one character FA into the second one character FA includes a state transition representing a repeated regular expression in which the number of repeated regular expressions is larger than the number of operating characters included in the first one character FA.
  • the second one-character FA is generated by replacing the state transition representing a repeated regular expression with the number of repetitions determined from the number M of operation characters.
  • first one-character FA is “one-character NFA”
  • second one-character FA is “one-character NFA for conversion”
  • first multi-character FA is “ Multi-character NFA for conversion” and “second multi-character FA” are expressed as “multi-character NFA”.
  • state transition for multi-character conversion is a process described as the repetition process of steps S201 to S209 in FIG. Moreover, about each said operation
  • the finite automaton generation device 1 when a regular expression including a repeated regular expression is given, repeats the regular regularity in the NFA in the unit of one character converted from the regular expression.
  • the state transition corresponding to the expression is replaced with the state transition composed of the minimum number of states without expanding to the concatenation of the basic elements corresponding to the number of repetitions. Convert to.
  • the number of NFA in single-character units that express regular expressions and NFA in multiple-character units is not proportional to the number of repeated regular expressions, but is proportional to the number of repeated regular expressions, it is repeated in regular expressions including repeated regular expressions. Even when the number of regular expression repetitions is increased, it is possible to keep the number of NFAs in units of one character and NFAs in units of multiple characters expressing the regular expression small.
  • the replaced NFA state number is used as information about the repeated regular expression.
  • a conversion unit that retains before conversion from a unit NFA to a multi-character unit NFA and does not change the state number when converting from a single character unit NFA to a multi-character unit NFA is used.
  • the NFA state number corresponding to the state transition corresponding to the pre-repetitive regular expression stored in advance is referred to and converted to a multi-character unit repetitive regular expression. Even after a single character unit NFA is converted to a multiple character unit NFA, the position where the repeated regular expression exists can be specified.
  • the position where the repeated regular expression exists can be specified even after the conversion to the NFA of a plurality of characters, when configuring an NFA circuit that can process a plurality of characters in one clock cycle, As an NFA circuit corresponding to a repeated regular expression, an efficient, for example, an NFA circuit configuration that requires less hardware resources can be selected and applied depending on the application.
  • the repeated characters have been described by taking single characters such as “A” and “B” as an example, but any regular expression can be used as long as the length of the matching character is one character. It may be specified as a repeated character.
  • a regular expression representing one of a plurality of characters such as “(A
  • the first effect is that even when the number of repeated regular expressions is increased in a regular expression including a repeated regular expression, the number of NFA in a single character unit or the number of NFAs in a multiple character unit, The amount of calculation at the time of conversion from NFA to multi-character NFA can be kept small.
  • the reason for this is that when a regular expression including a repeated regular expression is given, the state transition corresponding to the repeated regular expression is connected to the basic elements as many times as the number of repetitions in the NFA in units of one character converted from the regular expression. This is because the conversion is made from the NFA in units of one character to the NFA in units of a plurality of characters after being replaced with a state transition composed of a minimum number of states without being expanded.
  • the number of states is increased by referring to the relationship between the states related to the repeated regular expressions. Since the conversion method that suppresses the number of motion characters to about twice the number of operating characters is employed, an increase in the number of NFA states in units of a plurality of characters can be suppressed small.
  • the second effect is that the position where the regular expression exists repeatedly can be specified even after converting the NFA of one character unit to the NFA of a plurality of character units.
  • the state number of the replaced NFA is used as information regarding the repeated regular expression.
  • the third effect is that in an NFA circuit capable of processing a plurality of characters in one clock cycle, an efficient NFA circuit configuration can be applied as an NFA circuit corresponding to repeated regular expressions.
  • the position where the regular expression exists can be specified even after converting the NFA of one character unit to the NFA of a plurality of character units, so that an NFA that can process a plurality of characters in one clock cycle.
  • an efficient NFA circuit configuration can be selected and applied as an NFA circuit corresponding to a repeated regular expression in units of a plurality of characters.
  • the finite automaton is classified into two types: NFA (non-deterministic finite automaton) and DFA (deterministic finite automaton).
  • NFA non-deterministic finite automaton
  • DFA deterministic finite automaton
  • the above embodiment of the present invention has been described using NFA, the same configuration as that of the present embodiment can be applied to DFA.
  • 1-character NFA generating means 121 instead of generating 1-character NFA, 1-character DFA is generated, and when the 1-character DFA is generated, state transitions corresponding to repeated regular expressions are repeated. If the start state number is retained, a DFA in units of M characters that can process a plurality of characters at the same time is generated using a reduced description matrix having a small matrix size not only for NFA but also for DFA. Can do.
  • the configuration of the finite automaton generation apparatus in this case is the same as that described so far, and only “NFA” should be read as “DFA”.
  • FIG. 18 is a block diagram showing a configuration of a finite automaton generation device 401 according to the second embodiment of the present invention.
  • the finite automaton generation device 401 includes an input device 411, a data processing device 418, a storage device 414, and an output device 413, similarly to the finite automaton generation device 1 according to the first embodiment.
  • the data processing device 418 is a central part of a computer device constituted by a CPU, a RAM, an OS, etc., and is a main body that executes a program.
  • a process corresponding to the HDL conversion unit 25 is realized by a regular expression-HDL conversion program 415 executed by the data processing device 418.
  • the regular expression-HDL conversion program 415 is read into the data processing device 418 and controls the operation of the data processing device 418.
  • the regular expression storage unit 431, the 1-character NFA storage unit 432, and the 1-character for conversion are repeatedly stored in the storage device 414.
  • An NFA storage unit 433, a conversion multi-character NFA storage unit 434, and a multi-character NFA storage unit 435 are generated.
  • Each function is the same as the function unit having the same name in the data processing apparatus 12 of the first embodiment described above.
  • the data processing device 418 can perform the same processing as the processing by the data processing device 12 in the first embodiment under the control of the regular expression-HDL conversion program 415, and can obtain the same effect.
  • the second embodiment can be applied not only to NFA but also to DFA.
  • Other configurations and operational effects are the same as those of the first embodiment described above.
  • FIG. 19 is a block diagram showing a configuration of a finite automaton generation device 501 according to the third embodiment of the present invention.
  • the finite automaton generation device 501 is a configuration device for configuring the configuration in a reconfigurable hardware device such as an FPGA. 541, an input device 550 for inputting to a data pattern matching device to be subjected to pattern matching, a pattern matching device 560 having a reconfigurable hardware device such as an FPGA, a display device for outputting the result of pattern matching, An output device 570 such as a printing device is provided.
  • a reconfigurable hardware device such as an FPGA
  • An output device 570 such as a printing device is provided.
  • Other configurations and operational effects are the same as those of the first embodiment described above.
  • the data processing device 516 is obtained by adding a configuration data converting unit 526 to the data processing device 12 of the first embodiment shown in FIG. Others are the same as those in the first embodiment.
  • the storage device 514 stores an HDL storage unit 536 in addition to the storage units in the storage device 14 of the first embodiment shown in FIG.
  • the HDL storage unit 536 stores the HDL circuit description converted by the HDL conversion unit 25.
  • the configuration data conversion unit 526 When the configuration data conversion unit 526 receives a signal indicating that the conversion from the regular expression to the HDL circuit description is completed from the HDL conversion unit 25, the configuration data conversion unit 526 reads the multi-character NFA received from the HDL conversion unit 25 from the HDL circuit description that describes the multi-character NFA. Then, the data is converted into configuration data that is configuration information of a reconfigurable hardware device included in the pattern matching device 560. When the conversion is completed, the data is output to the configuration device 541.
  • a development tool provided by the vendor can be used for the conversion from the HDL circuit description to the configuration data.
  • the configuration device 541 When the configuration device 541 receives the configuration data from the configuration data conversion unit 526, the configuration device 541 configures and sets a reconfigurable hardware device that implements the pattern matching unit 562 of the pattern matching device 560.
  • the configuration device 541 includes a control program for configuring the configuration of a reconfigurable hardware device such as an FPGA, a write cable for transferring data to the hardware device, and the like.
  • a reconfigurable hardware device such as an FPGA
  • a write cable for transferring data to the hardware device, and the like.
  • FPGA reconfigurable hardware device
  • a development tool provided by a device vendor such as FPGA is used.
  • the pattern matching device 560 includes a data input unit 561, a pattern matching unit 562, and a result output unit 563.
  • the data input unit 561, the pattern matching unit 562, and the result output unit 563 are configured on separate reconfigurable hardware devices.
  • the data input unit 561 shapes the packet data input from the data input device 174, pattern matching target data such as text data (referred to as “searched data”), and the number of simultaneous operations generated by the data processing device 516. And the data to be searched is input to the pattern matching unit 562 in units of the number of simultaneously processed characters.
  • the pattern matching unit 562 is a circuit configured by configuration data generated by the data processing device 16 input via the configuration device 541, and is a multi-character NFA circuit itself generated by the data processing device 16. is there.
  • a state transition occurs each time data to be searched is input from the data input unit 561, and when the data matches the pattern, the signal from the register constituting the end state A signal indicating that the pattern matches and information on the searched data that matches the pattern (for example, the position of the searched data that matches the pattern) are output to the result output unit 563.
  • the result output unit 563 receives a signal indicating that the pattern matches the pattern input from the pattern matching unit 562 and information on the searched data that matches the pattern.
  • the result output unit 563 processes information such as which input character string matches which input input search data, and outputs the processed data to the result output device 175. Note that there is a method of notifying which pattern is matched by a previously defined pattern number or the like.
  • a multi-character NFA that performs transition with the number of processing characters designated from one character NFA is converted, and after generating an HDL description that describes the NFA circuit, HDL
  • the NFA circuit described by the description is configured on a hardware device in the pattern matching apparatus, and a pattern matching apparatus using the NFA circuit can be realized.
  • the number of NFA states in units of one character can be reduced, and as a result, the amount of calculation at the time of conversion from one character NFA to multi-character NFA Therefore, it is possible to reduce the time required to obtain the HDL description of the circuit that obtains the NFA in units of M characters after the regular expression is input and finally searches for the specified regular expression. it can.
  • an HDL circuit description describing a multi-character NFA circuit can be obtained in a short time. Therefore, a configuration obtained by converting the HDL circuit description describing the NFA circuit is converted. Data can be obtained in a short time, and the time from when a new regular expression is input from the input device 11 until the regular expression reflects the configuration of the pattern matching unit 562 can be shortened.
  • an NFA circuit configuration or the like can be selected and applied depending on the application.
  • HDL circuit description describing the multi-character NFA generated by the data processing device controlled by the regular expression-HDL conversion program 415 in the second embodiment is input to the configuration data conversion unit 526, and the HDL is described. Configuration data may be generated from the circuit description.
  • the data input unit 561, the pattern matching unit 562, and the result output unit 563 are configured on separate reconfigurable hardware devices. May be configured on the same reconfigurable hardware device.
  • the data input unit 561 and the result output unit 563 are configured on the same reconfigurable hardware device, and the pattern matching unit 562 is configured on another reconfigurable hardware device. There are no restrictions on the relationship between the unit 562, the result output unit 563, and the reconfigurable hardware device in which these units are arranged.
  • the data input unit 561 and the result output unit 563 can be configured as non-reconfigurable hardware devices such as ASIC (Application Specific Specific Integrated Circuit).
  • a data input unit 561 and a result output unit are provided in a part where the pattern matching unit 562 can be reconfigured using a hardware device in which only a part of the hardware device can be reconfigured and the other part cannot be reconfigured.
  • 563 may be configured as a hardware device that cannot be reconfigured.
  • the configuration data conversion unit 526 includes an HDL conversion unit. This can be dealt with by reading not only the HDL circuit description describing the NFA circuit generated at 25, but also the HDL circuit description describing the circuit of the data input unit 561 and the result output unit 563 and generating configuration data.
  • the configuration matching unit 562 of the pattern matching device 560 is used by using the received configuration data.
  • a storage device is provided in the configuration device 541, and once received configuration data is stored in the storage device provided in the configuration device 541.
  • the configuration data may be read from the storage device, and a reconfigurable hardware device that implements the pattern matching unit 562 of the pattern matching device 560 may be configured and set.
  • the configuration apparatus 541 starts the configuration of a reconfigurable hardware device that realizes the pattern matching unit 562 when receiving configuration data from the configuration data conversion unit 526.
  • a storage device is installed in the configuration device 541.
  • the pattern matching of the pattern matching device 560 is performed.
  • Considering the operation status of the grayed portion 562 may start to configure the reconfigurable hardware devices to implement the pattern matching unit 562 at good timing convenient to the operation of the pattern matching unit 562 of the pattern matching apparatus 560.
  • the third embodiment can be applied not only to the NFA but also to the DFA as in the first and second embodiments.
  • the present invention can be applied to applications such as an HDL generation system and a generation program that describe an NFA circuit for performing pattern matching processing using regular expressions.
  • applications such as an HDL generation system and a generation program that describe an NFA circuit for performing pattern matching processing using regular expressions.
  • an NFA circuit with HDL generated using the present invention, it can be applied to applications such as a pattern matching device for performing high-speed pattern matching processing using regular expressions.
  • a packet processing circuit to the pattern matching device, a network intrusion detection system (NIDS) and a network intrusion prevention system (NIPS: Network Intrusion Prevention System), NFA circuit generation system for hardware accelerator, generation program, which can be applied to computer virus detection system, which is an alternative to software-based pattern matching processing installed in personal computers and workstations, and It can also be applied to a regular expression search hardware accelerator device.
  • NIDS network intrusion detection system
  • NIPS Network Intrusion Prevention System
  • FIG. 11 is a conceptual diagram illustrating a result of converting a regular expression “BCD ((A ⁇ 100 ⁇
  • FIG. 3 is a transition diagram showing a one-character NFA obtained from the syntax tree shown in FIG. 2. It is a table
  • FIG. 6 is a flowchart showing details of replacement of the repeated regular expression shown in step S102 of FIG. 5 with state transition for multi-character conversion.
  • FIG. 6 is a transition diagram showing one character NFA for conversion obtained at the time of completion up to step S102 in FIG.
  • FIG. 6 is a conceptual diagram illustrating a repeated regular expression information list held in a repeated regular expression storage unit at the time of completion up to step S102 in FIG. 5.
  • FIG. 6 is a transition diagram showing a conversion one-character NFA stored in a conversion one-character NFA storage unit after performing the ⁇ -closure process in step S103 of FIG. 5;
  • FIG. 6 is a conceptual diagram illustrating a repeated regular expression information list held in a repeated regular expression storage unit at the time of completion up to step S103 in FIG. 5.
  • FIG. 13 is a transition diagram showing the multi-character NFA at the time when the copy state shown in step S303 of FIG. 12 is generated.
  • FIG. 13 is a transition diagram showing a multi-character NFA at the time when the processing up to step S304 in FIG. 12 is completed.
  • FIG. 13 is a conceptual diagram for explaining the operation of step S305 in FIG. 12 for the first entry in the repeated regular expression information list used for explaining the operation of the multi-character NFA conversion post-processing unit.
  • FIG. 15 is a transition diagram showing the M-character unit repeated regular expression assigned in step S306 of FIG. 12 added to the multi-character NFA of FIG.
  • It is a conceptual diagram which shows the example of NFA circuit structure for comprising the repeating regular expression "AAAA ⁇ 24 ⁇ " of a 4-character unit.
  • It is a block diagram which shows the structure of the finite automaton production
  • FIG. 1 It is a block diagram which shows the structure of the finite automaton production

Abstract

【課題】状態数や演算量を小さく抑えることができる、有限オートマトン回路生成装置を提供する。 【解決手段】本発明に係る有限オートマトン生成装置1は、正規表現および動作文字数の入力を受け付ける入力装置11と、正規表現に基づいて1文字FAを生成する1文字FA生成部21と、動作文字数に基づいて1文字FAに含まれる繰り返し正規表現を多文字変換用の状態遷移に置換する多文字変換前処理部22と、多文字変換用の状態遷移と動作文字数を用いて1文字FAから多文字FAを生成する多文字FA変換部23と、多文字FA中の動作文字数以上の繰り返し正規表現を動作文字数単位の繰り返し正規表現に置き換える多文字変換後処理部24とを有する。

Description

有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム
 本発明は、文字列照合用有限オートマトン回路の生成に関し、特に複数文字を同時に処理する文字列照合用有限オートマトン回路の生成に関する。
 ネットワークへの不正侵入の検知、あるいはコンピュータウィルスの検出などでは、文字列データから特定のパターンを検出する文字列照合(パターンマッチング)を、迅速に行う必要がある。そこで、例えば非特許文献2に示されるように、非決定性有限オートマトン(NFA:Non-deterministic Finite Automaton)を直接ハードウェア回路として回路化し、FPGA(Field Programmable Gate Array)のような再構成可能なデバイス上に組み込むことで、高速なパターンマッチングを行う手法が提案されている。以後、NFAを直接変換して得られたハードウェア回路をNFA回路と呼ぶこととする。また、NFAとDFA(決定性有限オートマトン:Deterministic Finite Automaton)とを総称してFA(有限オートマトン:Finite Automaton)という。
 このようなハードウェアを用いたパターンマッチングは、正規表現を用いて記述された検索対象パターンを表すNFAを生成し、生成されたNFAを直接ハードウェア回路に変換することで、並列動作の特性を生かした高速な処理が可能である。
 NFAを直接ハードウェア回路に変換する方法では、正規表現を構成する基本パターンをそれぞれ所定の回路に変換することでハードウェア回路を構成する。全ての正規表現は、「文字」“c”(文字c自身にマッチする)、「連結」“XY”(正規表現XとYがこの順序で現れる)、「選択」“X|Y”(XかYが現れる)、「繰り返し」“X*”(Xが0回以上現れる)の4種類の基本パターンで構成することができ、非特許文献2では、これらの4種類の基本パターンに対するハードウェア回路の構成方法を開示している。
 正規表現には、指定文字が指定された回数だけ繰り返し登場することを示す表現がある(以後「指定文字が指定された回数だけ繰り返し登場することを示す表現」を「繰り返し正規表現」という)。例えば、“c{N}”という正規表現は、文字cのN回繰り返しを表す。非特許文献4のpp.105~107では、正規表現“c{N}”を正規表現の4種類の基本パターンの組み合わせに展開することなしに、正規表現“c{N}”に対応するNFA回路を少ないハードウェア資源で構成する方法が開示されている。
 しかしながら、非特許文献2や非特許文献4で開示されているNFA回路は、1クロックサイクルあたり1文字しか処理することができないため、検索スループットは動作周波数に比例した値となる。
 そこで、1クロックサイクルあたりに処理できる文字数(バイト数)を増加させることで、検索スループットの向上を行う手法が提案されている。1クロックサイクルあたりに複数文字を処理できるNFA回路を作成するために、遷移条件として複数文字を受け付けるNFA(以後、多文字NFAという)を作成する必要がある。
 非特許文献3では、行列演算を用いて1文字単位のNFA(以後、1文字NFAという)から多文字NFAを生成する方法が開示されている。しかしながら、非特許文献3で開示されている方法を適用するためには、指定された正規表現をあらかじめ前述の4種類の基本パターンに展開する必要がある。
近藤 嘉雪 著、"定本Cプログラマのためのアルゴリズムとデータ構造"、ソフトバンクパブリッシング、1998年、第297-330頁 R. Sidhu and V. K. Prasanna, "Fast Regular Expression Matching usingFPGAs," Proceedings of 9th IEEE Symposium on Field-Programmable CustomComputing Machines (FCCM'01), April 2001., pp.227-238. 山垣則夫、神谷聡史、電子情報通信学会技術研究報告(リコンフィギャラブルシステム)、Vol.107、No.225、2007年、第65-70頁 "Regular Expression Matching in Reconfigurable Hardware,"IOANNIS SOURDIS AND STAMATIS VASSILIADIS, Journal of Signal Processing Systems51, pp.99-121, 2008 (http://www.springerlink.com/content/ck107775u5443781/)
 しかしながら、ハードウェアにNFAを直接埋め込んで1クロックサイクルに複数文字に対するパターンマッチングを行う方法で、繰り返し正規表現c{N}を実現する場合、以下のような問題がある。
 第1の問題点は、非特許文献3にて開示されている方法を用いて、遷移条件として複数文字を受け付けるNFA(多文字NFA)を作成するためには、繰り返し正規表現“c{N}”をあらかじめ4種類の基本パターンの組み合わせに展開する必要があり、文字の繰り返し回数が多くなると、1文字NFAや多文字NFAの状態数や、非特許文献3記載のNFA記述行列のサイズが大きくなってしまうことである。
 その理由を以下に述べる。NFAをハードウェアに直接埋め込む形のパターンマッチング回路の適用例の一つであるネットワーク侵入検知システムにおけるパターンマッチングルールでは、指定文字の繰り返し回数が1000回以上など、繰り返し回数が非常に多い例もある。例えば、侵入検知システムの一つであるSnortのルールセットには“¥sCREATE¥s[^¥n]{1024}”といった正規表現も含まれている。この表現は、空白文字、“CREATE”という文字列、空白文字が続いた後に、改行文字以外の一文字が1024回繰り返すことを表す。
 図20は、非特許文献3に記載の方法で、繰り返し正規表現を含む正規表現“BCDA{93}STU”(“BCD”の後に、文字Aの93回繰り返しが続き、さらに“STU”が続く)を基本パターンの組み合わせに展開した1文字NFAを示す概念図である。図21は、図20と同じ方法で同じ正規表現を表現したNFA変換行列を示す概念図である。なお、図21において要素の値が記載されていない要素は0である。
 図20の1文字NFAにおいて、丸印の中の数字はNFAの状態番号を示す。また、図21のNFA変換行列Sの左側の数字および上側の数字は1文字NFAにおける状態番号を示す。NFA変換行列のi行j列は1文字NFAにおける状態iから状態jへの遷移条件となる文字集合を表し、例えば3行4列の要素“A”は、1文字NFAの状態3から状態4への遷移条件“A”を示す。図20の1文字NFAにおいて、状態3から状態96まで文字“A”による遷移が93回繰り返されている。
 図21のNFA変換行列において、図20の1文字NFAにおける状態3から状態96まで文字“A”による遷移の93回繰り返しに対応する部分が、3行4列から95行96列まで“A”が93個斜めに並んでいる部分である。全体として、NFA変換行列Sは100行100列となる。
 このように、NFAの状態数やNFA変換行列のサイズは、繰り返し正規表現の指定文字の繰り返し回数に大きく依存する。繰り返し回数が繰り返し正規表現以外の状態数に比べて大きい場合には、繰り返し正規表現の繰り返し回数をNとすると、NFAの状態数およびNFA記述行列のサイズはO(N)となる。一般に、サイズD×Dの正方行列同士の掛け算の計算量はO(D^3)であり、繰り返し正規表現における指定文字の繰り返し回数が大きくなると、NFA変換行列の演算に要する計算量が急速に増大する。
 したがって、NFAの状態数を増加させることなしに、遷移条件として複数文字を受け付けるNFA(多文字NFA)を作成する方法が必要である。
 第2の問題点は、遷移条件として複数文字を受け付けるNFA(多文字NFA)を生成した場合に、繰り返し正規表現が存在する位置を把握するのが難しいことである。
 その理由を以下に述べる。例えば、繰り返し正規表現“A{1000}”を例にすると、これは文字“A”が1000回連続することを示すので、遷移条件が4文字のNFAにおいても文字列“AAAA”が250回程度連続することが期待される。しかしながら、非特許文献3にて開示されている方法を用いて、遷移条件として複数文字を受け付けるNFA(多文字NFA)を作成するためには、繰り返し正規表現“c{N}”をあらかじめ4種類の基本パターンの組み合わせに展開する必要があり、一度繰り返し正規表現“c{N}”を基本パターンに展開してしまうと、遷移条件として複数文字を受け付けるNFAにおいて繰り返し正規表現に対応する状態を特定することが困難だからである。
 第3の問題点は、1クロックサイクルに複数文字を処理できるNFA回路において、繰り返し正規表現“c{N}”に対応するNFA回路として効率のよいNFA回路構成を用いるが困難なことである。
 その理由を以下に述べる。1クロックサイクルに複数文字を処理できるNFA回路において、繰り返し正規表現“c{N}”に対応するNFA回路構成として効率のよいNFA回路構成を用いるためには、遷移条件として複数文字を受け付けるNFA(多文字NFA)を生成した場合に、繰り返し正規表現に対応する状態を特定する必要がある。しかしながら、第2の問題点において述べた理由により、非特許文献3にて開示されている方法を用いて、遷移条件として複数文字を受け付けるNFA(多文字NFA)を作成する際には、繰り返し正規表現“c{N}”をあらかじめ4種類の基本パターンの組み合わせに展開する必要があり、遷移条件として複数文字を受け付けるNFAにおいて繰り返し正規表現に対応する状態を特定することが困難だからである。
 したがって、繰り返し正規表現“c{N}”に対応する効率のよいNFA回路構成、例えば非特許文献4において開示されているNFA回路構成、を用いて、1クロックサイクルに複数文字を処理できるNFA回路を構成することが困難となる。
 以上で述べた各々の問題は、NFAに限られるものではなく、DFAにおいても起こりうる。
 本発明の目的は、繰り返し正規表現を含む正規表現において繰り返し正規表現の繰り返し回数が多くなった場合でも、正規表現を表現する1文字FAや多文字FAの状態数や、1文字FAから多文字FAへの変換時の演算量を少なく抑えることを可能とする、有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびそのプログラムを提供することにある。
 上記目的を達成するため、本発明に係る有限オートマトン生成装置は、入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行う有限オートマトン生成装置であって、正規表現および有限オートマトンの遷移条件に係る動作文字数の入力を受け付ける入力装置と、正規表現に基づいて第1の1文字FAを生成する1文字FA生成部と、動作文字数に基づいて第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成する多文字変換前処理部と、多文字変換前処理部によって変換された第2の1文字FAから、動作文字数に基づいて第1の多文字FAを生成する多文字FA変換部と、多文字FA変換部によって生成された第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成する多文字変換後処理部と、を有することを特徴とする。
 上記目的を達成するため、本発明に係るパターンマッチング装置は、入力データに対してパターンマッチング処理を行うパターンマッチング装置であって、入力データを受け付けるデータ入力部と、パターンマッチング処理の結果を出力する結果出力部とを備え、データ入力部と結果出力部との間に入力データに対してパターンマッチング処理を行うパターンマッチング部を設け、このパターンマッチング部の動作内容が請求項5に記載の有限オートマトン生成装置によって生成された回路記述に基づいて特定されることを特徴とする。
 上記目的を達成するため、本発明に係る有限オートマトン生成方法は、入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行う有限オートマトン生成方法であって、正規表現および当該正規表現に係る動作文字数の入力を受け付け、正規表現に基づいて第1の1文字FAを生成し、動作文字数に基づいて第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成し、第2の1文字FAから動作文字数に基づいて第1の多文字FAを生成し、第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成することを特徴とする。
 上記目的を達成するため、本発明に係る有限オートマトン生成プログラムは、入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行う有限オートマトン生成装置を制御するコンピュータに、正規表現および当該正規表現に係る動作文字数の入力を受け付ける処理と、正規表現に基づいて第1の1文字FAを生成する処理と、動作文字数に基づいて第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成する処理と、第2の1文字FAから動作文字数に基づいて第1の多文字FAを生成する処理と、第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成する処理とを実行させることを特徴とする。
 本発明は、繰り返し正規表現に対応する状態遷移を、繰り返し回数分の基本要素の連接に展開せず、必要最小限の状態数で構成される状態遷移に置き換えた上で、1文字単位のFAから複数文字単位のFAへの変換を行うように構成したことによって、正規表現を表現する1文字単位のFAや複数文字単位のFAの状態数や、1文字FAから多文字FAへの変換時の演算量を少なく抑えることができる。
[第1の実施の形態]
 以下、本発明の第1の実施の形態を図1に基づいて説明する。
 最初に、本実施の形態の基本的な内容について説明し、その後で具体的な内容について説明する。
 本実施の形態に係る有限オートマトン生成装置1は、入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、前記1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行うものであり、正規表現および有限オートマトンの遷移条件に係る動作文字数の入力を受け付ける入力装置11と、正規表現に基づいて第1の1文字FAを生成する1文字FA生成部21と、動作文字数に基づいて第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成する多文字変換前処理部22と、多文字変換前処理部によって変換された第2の1文字FAから、動作文字数に基づいて第1の多文字FAを生成する多文字FA変換部23と、多文字FA変換部によって生成された第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成する多文字変換後処理部24と、を有するように構成されている。
 このうち、多文字変換前処理部22は、第1の1文字FAに含まれる、繰り返し正規表現の繰り返し回数が動作文字数より大きい繰り返し正規表現を表す状態遷移を、動作文字数によって決定される繰り返し回数の繰り返し正規表現を表す状態遷移に置換することで第2の1文字FAを生成する。
 また、多文字変換後処理部24で、第1の多文字FAに含まれる、繰り返し正規表現に対応する多文字変換用の状態遷移を、動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えるための変換手順は、繰り返し正規表現の繰り返し文字数と動作文字数により決定される。
 このようにすることにより、必要最小限の状態数で構成される状態遷移に置き換えた上で、1文字単位のFAから複数文字単位のFAへの変換を行うことによって、正規表現を表現する1文字単位のFAや複数文字単位のFAの状態数や、1文字FAから多文字FAへの変換時の演算量を少なく抑えることを可能となる。
 以下、これをさらに詳述する。なお、以後の実施例はNFAに対する処理について説明しており(「NFA」を「DFA」に読み替えるだけで、DFAについても適用できる)、「第1の1文字FA」は「1文字NFA」、「第2の1文字FA」は「変換用1文字NFA」、「第1の多文字FA」は「変換用多文字NFA」、「第2の多文字FA」は「多文字NFA」として記載している。また、「多文字変換用の状態遷移」は、後述する図6のステップS201~209の繰り返し処理として記載される処理である。
 図1は本発明の第1の実施の形態に係る有限オートマトン生成装置1の構成を示すブロック図である。有限オートマトン生成装置1は、キーボードなどの入力装置11と、CPU、RAM、OSなどによって構成されるコンピュータ装置の中心部であり、プログラムを実行する主体であるデータ処理装置12と、RAMなどのような揮発性の記憶手段から構成される記憶装置14と、ディスプレイ装置やプリンタ装置などの出力装置13から構成される。
 記憶装置14は、繰り返し正規表現記憶部31、1文字NFA記憶部32、変換用1文字NFA記憶部33と変換用多文字NFA記憶部34と多文字NFA記憶部35とを備える。繰り返し正規表現記憶部31は、1文字NFA生成部21が入力装置11より読み込んだ正規表現に含まれる繰り返し正規表現に関する情報を保持し、多文字NFA変換前処理部22および多文字NFA変換後処理部24における多文字NFA変換処理において参照される。
 1文字NFA記憶部32は、1文字NFA生成部21が入力装置11より読み込んだ正規表現から変換した1文字NFAを保持する。変換用1文字NFA記憶部33は、多文字NFA変換前処理部22が1文字NFA記憶部32に保持された1文字NFAから変換した変換用1文字NFAを保持する。
 変換用多文字NFA記憶部34は、多文字NFA変換部23が、変換用1文字NFA記憶部33に保持された変換用1文字NFAから変換して得られた多文字NFAである変換用多文字NFAを保持する。
 多文字NFA記憶部35は、多文字NFA変換後処理部24が、変換用多文字NFA記憶部34に保持された変換用多文字NFAから変換した最終的な多文字NFAを保持する。
 1文字NFA記憶部32、変換用1文字NFA記憶部33、変換用多文字NFA記憶部34、多文字NFA記憶部35に保持されるNFAのデータ構造はNFAを表現可能なデータ構造であればどのようなデータ構造でもよく、具体例としてはリスト構造や行列形式などのデータ構造が挙げられる。
 データ処理装置12は、1文字NFA生成部21、と多文字NFA変換前処理部22と、多文字NFA変換部23と、多文字NFA変換後処理部24と、HDL変換部25といった各機能を実行する。これらの機能部は、データ処理装置12によって実行されるプログラムとして実現されるものであり、これらのプログラムが記録された媒体も特許の範囲として含まれる。
 1文字NFA生成部21は、入力装置11から正規表現を読み込み、読み込んだ前記正規表現を1文字NFAに変換し、変換した1文字NFAを1文字NFA記憶部32に保存し、多文字NFA変換前処理部22に1文字NFAへの変換が完了したことを通知する。正規表現を1文字NFAに変換する際に、繰り返し正規表現“c{N}”を正規表現の基本パターンである「N個の文字“c”の連接」に展開することは行わない。また、正規表現に含まれる繰り返し正規表現とその繰り返し正規表現に対応する1文字NFAの状態番号を、繰り返し正規表現情報リストとして繰り返し正規表現記憶部31に保持する。
 多文字NFA変換前処理部22は、入力装置11から動作文字数を読み込む。動作文字数は、生成する多文字NFAの遷移条件となる文字(列)の長さであり、以後の説明では動作文字数をMで表す。本発明では、NFAをハードウェアに直接埋め込んで1クロックサイクルに複数文字に対するパターンマッチングを行う方法で、繰り返し正規表現“c{N}”を含む場合を対象としているため、Mは2以上の自然数となる。
 M=1の場合は、1クロックサイクルにおいて1文字しか処理しないことを示すので、繰り返し正規表現“c{N}”に対応するNFA回路として非特許文献4により開示されているNFA回路構成を用いることで、少ないハードウェア資源でNFA回路を構成することができる。
 多文字NFA変換前処理部22は、1文字NFA生成部21から変換完了の通知を受信すると、1文字NFA記憶部32から繰り返し正規表現“c{N}”が展開されていない1文字NFAを読み出し、1文字NFAに含まれる繰り返し正規表現を多文字変換用の状態遷移に置き換え、生成された1文字NFAを変換用1文字NFAとして変換用1文字NFA記憶部33に格納し、多文字NFA変換部23に変換用1文字NFAへの変換が完了したことを通知する。1文字NFAに含まれる繰り返し正規表現を多文字変換用の状態遷移に置き換える際に、繰り返し正規表現記憶部31に保持された繰り返し正規表現情報リストに、置き換えた多文字変換用の状態遷移に関する情報を追加する。
 多文字NFA変換部23は、入力装置11から動作文字数を読み込む。動作文字数の意味は、上記の多文字NFA変換前処理部22の説明において述べた意味と同じである。多文字NFA変換部23は、多文字NFA変換前処理部22から変換完了の通知を受信すると、非特許文献3にて開示された方法を用いて、変換用1文字NFA記憶部33に保持された変換用1文字NFAから、多文字NFAを生成し、生成された多文字NFAを変換用多文字NFAとして変換用多文字NFA記憶部34に格納し、多文字NFA変換後処理部24に変換用多文字NFAへの変換が完了したことを通知する。
 多文字NFA変換後処理部24は、入力装置11から動作文字数を読み込む。動作文字数の意味は、多文字NFA変換前処理部22の説明において既に述べた意味と同じである。
 多文字NFA変換後処理部24は、多文字NFA変換部23から変換完了の通知を受信すると、繰り返し正規表現記憶部31に保持された繰り返し正規表現情報リストに基づき、変換用多文字NFA記憶部34に保持された変換用多文字NFAに含まれる多文字変換用の状態遷移を、M文字単位の繰り返し正規表現に置き換え、生成された多文字NFAを多文字NFA記憶部35に格納し、HDL変換部25に多文字NFAへの変換が完了したことを通知する。
 HDL変換部25は、多文字NFA変換後処理部24から変換完了の通知を受信すると、多文字NFA記憶部35に保持された多文字NFAから、そのNFAの状態、状態間の遷移、遷移条件等の情報を分析し、各状態をレジスタに、遷移条件を文字(列)比較器に変換し、状態間の遷移に応じて各レジスタの間を接続し、VerilogやVHDLなどのハードウェア記述言語(HDL;Hardware Description Language)で記述された、そのNFA回路を示す回路記述に変換し、出力装置13に出力する。この回路記述を記述する手段としては、HDLの他には、LSIやFPGAの回路部品の接続関係をテキストで表現するために使われるネットリストなどを用いてもよい。
 この際、多文字NFA記憶部35に保持された多文字NFAに含まれるM文字単位の繰り返し正規表現に対応するNFA回路として、非特許文献4により開示されているNFA回路構成を用いる。繰り返し正規表現に対応する状態遷移に関する部分以外の多文字NFAをNFA回路に変換する方法は、非特許文献2、非特許文献3、非特許文献4で開示されている。
 以下、有限オートマトン生成装置1の動作について、具体例を用いて詳細に説明する。具体的には、正規表現“BCD((A{100}|E)S)*TU”、および動作文字数M=4が入力装置11から入力された場合を例にとり説明する。
 1文字NFA生成部21は、入力装置11から正規表現を読み込み、読み込んだ前記正規表現を1文字NFAに変換し、変換した1文字NFAを1文字NFA記憶部32に保存し、多文字NFA変換前処理部22に1文字NFAへの変換が完了したことを通知する。正規表現を1文字NFAに変換する際に、繰り返し正規表現“c{N}”を正規表現の基本パターンである「N個の文字“c”の連接」に展開することは行わない。
 また、正規表現に含まれる繰り返し正規表現とその繰り返し正規表現に対応する1文字NFAの状態番号を、繰り返し正規表現情報として繰り返し正規表現記憶部31に保持する。
 一般に、正規表現から1文字NFAへの変換は、正規表現から構文木(Syntax Tree)への変換と、構文木からNFAへの変換、の2つの処理に分けることができる(例えば、非特許文献1のp.327参照)。1文字NFA生成部21では、正規表現を1文字NFAに変換する際に、繰り返し正規表現“c{N}”を正規表現の基本パターンである「N個の文字“c”の連接」に展開することは行わないが、正規表現から構文木への変換を行う際に、繰り返し正規表現を認識しつつ、構文木を作成する必要がある。
 図2は、非特許文献4のp.111にて開示されている、正規表現“BCD((A{100}|E)S)*TU”を、繰り返し正規表現を認識しつつ構文木に変換した結果を示す概念図である。図2において、構文木のノードが文字である場合は正規表現内の個々の文字に対応し、構文木のノード「・」は正規表現の連接に、ノード「|」はオア(OR)を意味する正規表現のメタキャラクタに、ノード「*」は0回以上の繰り返しを意味する正規表現のメタキャラクタにそれぞれ対応する。
 図2の構文木において、ノード「繰り返し正規表現」は繰り返し正規表現に対応するノードであり、子要素として繰り返し文字と繰り返し回数を持つ。図2のノード「繰り返し正規表現」は“BCD((A{100}|E)S)*TU”に含まれる繰り返し正規表現“A{100}”に対応している。後述するように、A{100}は繰り返し文字「A」を繰り返し回数「100回」繰り返すことを意味する。
 図3は、図2に示した構文木から得られる1文字NFAを示す遷移図である。一般的に、構文木を1文字NFAに変換する一般的な方法として、非特許文献1や非特許文献2などに開示されている。このため、ここでは構文木内の「繰り返し正規表現」を表すノードに対する変換についてのみ説明する。構文木内の「繰り返し正規表現」を表すノードは1文字NFAにおいて繰り返し正規表現であることを示す1個の状態遷移に変換する。
 具体的には、図2の“A{100}”に対応する「繰り返し正規表現」は、図3の状態7と状態8を含む実線枠“A{100}”に対応する状態遷移に変換される。
 また、構文木から1文字NFAへの変換を行う際に、構文木において「繰り返し正規表現」を表すノードがあった場合、繰り返し正規表現に関する情報を繰り返し正規表現情報リストとして繰り返し正規表現記憶部31に格納する。
 図4は、図1に示した繰り返し正規表現記憶部31に記憶される繰り返し正規表現情報リストの一例を示す表である。リストの各エントリーは繰り返し正規表現の繰り返し文字、繰り返し正規表現の繰り返し回数、繰り返し正規表現に対応する1文字NFAでの状態遷移の開始番号から構成される。
 繰り返し正規表現情報リストのエントリーは正規表現内の繰り返し正規表現の個数分用意される。例として用いている正規表現“BCD((A{100}|E)S)*TU”では、繰り返し正規表現は“A{100}”の一つだけのため、繰り返し正規表現情報リストのエントリー数は1であり、”A{100}”に対応する繰り返し正規表現情報リストのエントリーの内容は、構文木の「繰り返し正規表現」を示すノードの情報に基づき、繰り返し文字が「A」、繰り返し回数が100となる。
 また、図3の1文字NFAにおいて“A{100}”に対応する状態遷移は状態7から状態8に対応する状態遷移であり、”A{100}”に対応する繰り返し正規表現情報リストのエントリーの開始状態番号には7が格納される。以上が、1文字NFA生成部21の動作である。
 次に、多文字NFA変換前処理部22の動作について説明する。図5は、多文字NFA変換前処理部22の動作を示すフローチャートである。まず入力装置11から動作文字数Mを読み込む(ステップS101)。動作文字数Mは、生成する多文字NFAの遷移条件となる文字(列)の長さであり、本発明ではMが2以上の自然数の場合を対象とする。前述のように、ここではM=4である。次に、1文字NFAに含まれる全ての繰り返し正規表現を多文字変換用の状態遷移に置き換えを行う(ステップS102)。
 図6は、図5のステップS102として示した繰り返し正規表現の多文字変換用の状態遷移への置き換えの詳細を示すフローチャートである。1文字NFAに含まれる全ての繰り返し正規表現に関する情報は、1文字NFA生成部21により繰り返し正規表現情報リストに登録されているため、1文字NFAに含まれる繰り返し正規表現すべてについて変換処理を行うことは、繰り返し正規表現情報リストの全てのエントリーについて処理を行うことと等価である。
 したがって、ステップS102では、繰り返し正規表現情報リストの全てのエントリーについて処理を行う(ステップS201~209の繰り返し処理)。ステップS102開始時点での繰り返し正規表現情報リストは図4に示す通りである。ステップS202~208が、繰り返し正規表現情報リストの各エントリーに関する処理である。
 以下の説明では、繰り返し正規表現情報リストのi番目のエントリーの繰り返し文字をAi、繰り返し回数をCi、開始状態番号をSiとする。まず、1個目のエントリーについて、ステップS202~208の処理を行う。最初にステップS203で、繰り返し回数Ciと動作文字数Mの比較を行う。図4に示す繰り返し正規表現情報リストの1個目のエントリーでは繰り返し回数Ci=100なので、Ci(=100)>M(=4)となり、ステップS204に進む。ステップS204では、開始状態番号Siから始まる繰り返し正規表現をM+1個の文字Aiの状態遷移で置換する。
 多文字NFA変換前処理部22が処理を開始する時点で1文字NFA記憶部32に格納されている1文字NFAは図3に示す通りである。繰り返し正規表現情報リストの1個目のエントリーでは、「開始状態番号Siから始まる繰り返し正規表現」は、図3の状態7と状態8を含む実線枠“A{100}”に対応する状態遷移である。
 これを、繰り返し文字Ai(=“A”)のM+1(=5)個の状態遷移で置換する。文字“A”の5個の状態遷移は、具体的には図7の状態7→8→9→10→11→12を囲んだ実線枠内の状態遷移に対応する。状態遷移が5回なので、両端の状態を含めて6個の状態から構成されている。
 次に、ステップS205において、文字“A”の5個の状態遷移を構成する状態のうち両端を除いた状態のうち、最も先頭に近い状態の番号、つまり置換後のM+1(=5)個の状態遷移の先頭から2番目の状態の番号を、繰り返し正規表現情報リストの1番目のエントリーの開始状態番号として格納する。図7の例では、置換後のM+1(=5)個の状態遷移の先頭から2番目の状態は状態8なので、繰り返し正規表現情報リストの1番目のエントリーの開始状態番号として8が格納される。
 以上で、これで1個目のエントリーに関する処理は終了である。例として用いている正規表現“BCD((A{100}|E)S)*TU”では、繰り返し正規表現は“A{100}”の一つだけのため、繰り返し正規表現情報リストに含まれるエントリーは1個であり、この時点で繰り返し正規表現情報リストの全エントリーについての処理が完了する。この時点での生成された1文字NFAを後述の図7に示す。
 一方、図6のステップS203において、繰り返し回数Ciと動作文字数Mの比較を行い、Ci≦M の場合には、繰り返し正規表現をそのままCi個の文字Aiの連接に展開する(ステップS206)。Ci≦Mの場合、繰り返し回数Ciの繰り返し正規表現とCi個の文字 Ai の連接は全く等価であり、多文字生成後処理部124において後処理を行う必要がないため、繰り返し正規表現情報リストから対応するエントリーを削除する(ステップS207)。
 例として用いている正規表現“BCD((A{100}|E)S)*TU”では、繰り返し回数がM回以下の繰り返し正規表現は含まれていないため、今回の例ではステップS206~7に該当する処理は行われない。以上で、ステップS102の処理が完了する。
 図7は、図5のステップS102まで完了した時点で得られた変換用1文字NFAを示す遷移図である。また図8は、図5のステップS102まで完了した時点での繰り返し正規表現記憶部31に保持されている繰り返し正規表現情報リストを示す概念図である。
 最後に、ステップS103において、変換用1文字NFAを、ε遷移を含まない1文字NFAに変換する。ε遷移を含むNFAをε遷移を含まないNFAに変換する方法は一般にε-クロージャ(ε-閉包)と呼ばれ、非特許文献1などで開示されている。ε-クロージャにより、繰り返し正規表現に対応する状態遷移、具体的には図7の状態7→8→9→10→11→12を囲んだ実線枠内の状態遷移の番号に変化があった場合には、繰り返し正規表現情報リストの対応するエントリーの開始状態番号を更新する。
 図9は、図5のステップS103のε-クロージャ処理を行った後の変換用1文字NFA記憶部33に記憶されている変換用1文字NFAを示す遷移図である。図9では、繰り返し正規表現“A{100}”に対応する状態遷移は、状態3→4→5→6→7→8に至る実線枠内の状態遷移であり、状態番号に変更が発生しているため、繰り返し正規表現情報リストも更新する。
 図10は、図5のステップS103まで完了した時点での、繰り返し正規表現記憶部31に保持されている繰り返し正規表現情報リストを示す概念図である。ステップS103でε遷移を含まない1文字NFAへの変換を行っているのは、次の多文字NFA変換部23で、(変換用)1文字NFAを(変換用)多文字NFAに変換する非特許文献3の方法では、入力としてε遷移を含まないNFAを与える必要があるためである。多文字NFA変換部23で、入力としてε遷移を含むNFAを与えることができる多文字NFA変換方法を用いる場合には、ステップS103のε遷移を含まない1文字NFAへの変換処理は不要である。また、本実施の形態の説明では、ステップS102において1文字NFAに含まれる繰り返し正規表現を多文字変換用の状態遷移に変換した後、ステップS103において変換用1文字NFAをε遷移を含まない1文字NFAに変換するε-閉包を行っているが、ε-閉包を行うタイミングに制約はなく、例えば、1文字NFA生成部21において正規表現から1文字NFAを生成した直後にε-閉包を行って、ε遷移を含まない1文字NFAを多文字NFA変換前処理部22に入力してもよい。
 多文字NFA変換前処理部22の処理では、ステップS102やステップS103における変換用1文字NFAの生成過程の中間データも変換用1文字NFA記憶部33に格納され、ステップS103まで完了した時点で、変換用1文字NFA記憶部33には完成した変換用1文字NFAが格納される。以上で、多文字NFA変換前処理部22の処理が完了する。
 次に、多文字NFA変換部23は、入力装置11から動作文字数を読み込む。動作文字数の意味は、上記の多文字NFA変換前処理部22の説明において述べた意味と同じである。多文字NFA変換部23は、多文字NFA変換前処理部22から変換完了の通知を受信すると、多文字変換部123では、非特許文献3にて開示されているNFA記述行列による変換方法を用いて、変換用1文字NFA記憶部33に格納された変換用1文字NFAから、多文字NFAを生成し、生成された多文字NFAを変換用多文字NFAとして変換用多文字NFA記憶部34に格納し、多文字NFA変換後処理部24に変換用多文字NFAへの変換が完了したことを通知する。
 NFA記述行列による変換方法は非特許文献3に詳細に説明されている。図11は、図1に示す多文字NFA変換部23による変換処理により生成され、変換用多文字NFA記憶部34に格納された変換用多文字NFAを示す遷移図である。
 多文字NFA変換部23で(変換用)1文字NFAから(変換用)多文字NFAへの変換に用いる方法としては、変換前と変換後で状態番号の変化が発生しない方法であればどのような方法でも使用することができる。「状態番号の変化が発生しない」とは、例えば、1文字単位のNFA(図9)から4文字単位のNFA(図11)への変換を行う際に、1文字単位のNFAにおいて状態2から文字列“DESA”と4文字分遷移すると状態4に到達するが、これが4文字のNFAにおいても遷移条件“DESA”で状態2から状態4へ遷移するというように、遷移先と遷移元の状態番号が変化しないことをいう。非特許文献3で開示されているNFA記述行列による方法はこの条件を満たす変換方法の一つである。
 次に、多文字NFA変換後処理部24の動作を説明する。多文字NFA変換後処理部24では、最初に入力装置11から動作文字数を読み込む。動作文字数の意味は、上記の多文字NFA変換前処理部22の説明において述べた意味と同じである。その後、多文字NFA変換部23から変換完了の通知を受信すると、変換用多文字NFA記憶部34に保持された変換用多文字NFAに含まれる多文字変換用の状態遷移を、M文字単位の繰り返し正規表現に置き換える処理を行う。
 図12は、図1に示した多文字NFA変換後処理部24が、変換用多文字NFA記憶部34に保持された変換用多文字NFAに含まれる多文字変換用の状態遷移を、M文字単位の繰り返し正規表現に置き換える処理の詳細を示すフローチャートである。
 多文字NFA変換後処理部24において後処理を行う必要のある繰り返し正規表現は、繰り返し文字数がMより大きい繰り返し正規表現全てであり、繰り返し正規表現記憶部31に保持されている繰り返し正規表現情報リストのエントリーと過不足なく1:1に対応している。なぜなら、多文字NFA変換後処理部24において後処理を行う必要のない繰り返し正規表現は繰り返し文字数がM以下の繰り返し正規表現であり、このような繰り返し正規表現は図6のステップS206~207において、繰り返し正規表現情報リストから削除されているからである。
 よって、多文字NFA変換後処理部24では繰り返し正規表現情報リストの全エントリーについて処理を行う(ステップS301~308の繰り返し)。ステップS302~307で挟まれた間のステップが繰り返し正規表現情報リストの個々のエントリーに対する処理である。多文字NFA変換後処理部24の処理が開始される時点での繰り返し正規表現記憶部31に保持されている繰り返し正規表現情報リストの内容は図10の通りである。繰り返し正規表現情報リストの1個目のエントリーに対する処理を例に図12のフローチャートの動作を説明する。
 最初に多文字NFA変換後処理部24は、繰り返し正規表現に対応する状態番号Siから始まるM個の状態のコピーを作成する(ステップS303)。繰り返し正規表現情報リストの1個目のエントリーでは開始状態番号は4であり、今回の動作例では動作文字数Mは4なので、「繰り返し正規表現に対応する状態番号Siから始まるM個の状態」は状態4、5、6、7のM(=4)個の状態である。これらM(=4)個の状態のコピーを生成する。
 図13は、図12のステップS303に示したコピー状態の生成まで行った時点での多文字NFAを示す遷移図である。図13では、状態4、5、6、7のコピーをそれぞれ状態4-2、5-2、6-2、7-2と表記している。
 次に多文字NFA変換後処理部24は、作成されたコピー状態へ出力方向の遷移を移動する。具体的には、状態4が遷移元となっている状態遷移があれば、その状態遷移の遷移元を状態4-2に変更する(ステップS304)。これを状態4が遷移元となっている状態遷移全てについて行う。状態5、6、7が遷移元となっている状態遷移も全て、それぞれ状態5-2、6-2、7-2が遷移元となるように変更する。
 図14は、図12のステップS304の処理まで完了した時点での多文字NFAを示す遷移図である。例えば、図13において状態6から状態8へ遷移条件“AASE”で遷移する状態遷移は、図14に示すように状態6-2から状態8への遷移条件“AASE”で遷移する状態遷移に変更される。また、図13において状態7から状態5へ遷移条件“ASAA”で遷移する状態遷移は、図14に示すように状態7-2から状態5への遷移条件“ASAA”で遷移する状態遷移に変更され、遷移先の状態が状態4、5,6、7のいずれかであっても遷移先は変更しない。
 次に多文字NFA変換後処理部24は、繰り返し正規表現に対応する状態とそのコピー状態に整理番号を割り振る(ステップS305)。具体的には、繰り返し正規表現に対応する状態番号Siから始まるM個の状態には、状態番号Siから順番に1からMまでの整理番号を割り当てる。繰り返し正規表現に対応する状態番号Siから始まるM個の状態に対応するM個のコピーには、状態番号Siに対応するコピーから順番にCi-MからCi-1までの整理番号を割り当てる。
 図15は、多文字NFA変換後処理部24の動作の説明に用いている、繰り返し正規表現情報リストの1個目のエントリーに対する図12のステップS305の動作を説明する概念図である。繰り返し正規表現情報リストの1個目のエントリーでは、繰り返し回数Ci=100であり、動作文字数M=4である。開始状態番号Si=4なので、繰り返し正規表現に対応する状態番号Siから始まるM個の状態は、ステップS303の説明でも述べたとおり状態4、5、6、7に対応する。
 このM(=4)個の状態に対しては、状態4から順番に1から4までの整理番号を割り当てる。また、繰り返し正規表現に対応する状態番号Siから始まるM個の状態に対応するM個のコピーは状態4-2、5-2、6-2、7-2である(状態4に対応する状態が状態4-2)。これら4(=M)個のコピー状態4-2、5-2、6-2、7-2に対して、状態4-2から順番にCi-M(=100-4=96)からCi-1(=100-1=99)の整理番号を割り当てる。これがステップS305の動作である。
 次に多文字NFA変換後処理部24は、擬似番号に基づきM文字単位の繰り返し正規表現による遷移に割り当てる(ステップS306)。具体的には、繰り返し正規表現に対応する状態番号Siから始まるM個の状態とそのコピーであるM個の状態を、整理番号をMで割った際の剰余が同じもの同士をペアとするM組のペアに分割し、各ペアを構成する状態間で、コピー状態が遷移先となるように、M文字単位の繰り返し正規表現を表す状態遷移を作成する。
 M文字単位の繰り返し正規表現は、繰り返し文字がM個の文字Ciであり、繰り返し回数は(コピー状態の整理番号―オリジナル状態の整理番号)÷Mとする。図15において、「繰り返し正規表現に対応する状態番号Siから始まるM個の状態」は状態4、5、6、7に、「そのコピーであるM個の状態」は状態4-2、5-2、6-2、7-2に対応する。各状態に割り当てられた整理番号をM(=4)で割った際の剰余を図15の各状態の傍に記す。状態4、5、6、7と状態4-2、5-2、6-2、7-2のうち、剰余が同じもの同士を選ぶと、図15の矢印で示すように状態のペアが4つ作成される。このペアの間で、状態4、5、6、7側が遷移元、状態4-2、5-2、6-2、7-2側が遷移先となる、M文字単位の繰り返し正規表現を表す状態遷移を作成する。
 例えば、状態4と状態5-2は剰余が1でペアを構成するが、整理番号の差分は97-1=96であり、これをM(=4)で割ると、M文字単位の繰り返し正規表現の繰り返し回数は24となる。また、繰り返し正規表現情報リストの1個目のエントリーの繰り返し文字Aiは“A”なので、M文字単位の繰り返し正規表現の繰り返し文字は“AAAA”(“A”がM(=4)個)となる。
 同様に、状態7と状態4-2は剰余が0でペアを構成するが、整理番号の差分は96-4=92であり、これをM(=4)で割ると、M文字単位の繰り返し正規表現の繰り返し回数は23となり、繰り返し正規表現の繰り返し文字は状態4→状態5-2の場合と同様に“AAAA”となる。
 図16は、図12のステップS306において割り当てられたM文字単位の繰り返し正規表現を、図14の多文字NFAに追加したものを示す遷移図である。ここで、“AAAA{24}”は、遷移条件“AAAA”が24回繰り返されることを示す。
 以上で、繰り返し正規表現情報リストの1個目のエントリーに対する処理は完了する。例として用いている正規表現“BCD((A{100}|E)S)*TU”では、繰り返し正規表現は“A{100}”の一つだけのため、繰り返し正規表現情報リストに含まれるエントリーは1個であり、この時点で繰り返し正規表現情報リストの全エントリーについての処理が完了する。以上で、多文字NFA変換後処理部24の動作が完了する。
 なお、多文字変換後処理部124の処理では、多文字NFAの生成過程の中間データも多文字NFA記憶部35に格納され、ステップS308まで完了した時点で、多文字NFA記憶部35には完成した多文字NFAが格納される。
 HDL変換部25は、多文字NFA変換後処理部24から変換完了の通知を受信すると、多文字NFA記憶部35に保持された多文字NFAから、そのNFAの状態、状態間の遷移、遷移条件等の情報を分析し、各状態をレジスタに、遷移条件を文字(列)比較器に変換し、状態間の遷移に応じて各レジスタの間を接続し、VerilogやVHDLなどのハードウェア記述言語(HDL: Hardware Description Language)で記述された、そのNFA回路を示す回路記述に変換し、出力装置13に出力する。
 この際、多文字NFA記憶部35に保持された多文字NFAに含まれるM文字単位の繰り返し正規表現に対応するNFA回路として、非特許文献4により開示されているNFA回路構成を用いる。例えば、4文字単位の繰り返し正規表現“AAAA{24}”を構成するためには、非特許文献4のFigure.4(c)に記載の回路構成で、左下の入力aに、連続する4つの入力文字が“AAAA”である場合に1が入力されるような回路構成を使用すればM文字単位の繰り返し正規表現に対応するNFA回路が構成できる。
 図17は、4文字単位の繰り返し正規表現“AAAA{24}”を構成するためのNFA回路構成例を示す概念図である。繰り返し正規表現に対応する状態遷移に関する部分以外の多文字NFAをNFA回路に変換する方法は、非特許文献2、非特許文献3、非特許文献4で開示されている。
 次に、上記の第1の実施の形態の全体的な動作について説明する。本発明の第1の実施の形態に係る有限オートマトン生成装置1は、正規表現および当該正規表現に係る動作文字数Mの入力を受け付け(図5:ステップS101)、入力された正規表現に基づいて第1の1文字FAを生成する。そして入力された動作文字数Mに基づいて、前述の第1の1文字FAに含まれるM文字単位の繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成する(図5:ステップS102~103)。これに続いて、この第2の1文字FAから前述の動作文字数Mに基づいて、第1の多文字FAを生成し、第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移をM文字単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成する(図12:ステップS301~308)という動作を行う。
 ここで、第2の多文字FAを出力する処理は、第1の多文字FAに含まれる、繰り返し正規表現に対応する多文字変換用の状態遷移を、あらかじめ定められた演算ルールに基づき、図12~16で説明したように、動作文字数M単位の繰り返し正規表現を表す状態遷移に置き換えるという処理である。
 また、第1の1文字FAを第2の1文字FAに変換する処理は、第1の1文字FAに含まれる、繰り返し正規表現の繰り返し回数が動作文字数より大きい繰り返し正規表現を表す状態遷移を、図6~7で説明したように、動作文字数Mより決定される繰り返し回数の繰り返し正規表現を表す状態遷移に置換することで、第2の1文字FAを生成するという処理である。
 なお、前述の説明の中で「第1の1文字FA」は「1文字NFA」、「第2の1文字FA」は「変換用1文字NFA」、「第1の多文字FA」は「変換用多文字NFA」、「第2の多文字FA」は「多文字NFA」と表記した。また、「多文字変換用の状態遷移」は、図6のステップS201~209の繰り返し処理として記載された処理である。
 また、上記各動作ステップについては、これをコンピュータで実行可能にプログラム化し、これらを前記各ステップを直接実行する有限オートマトン生成装置1が備えているコンピュータに実行させるようにしてもよい。
 このように本発明の第1の実施の形態に係る有限オートマトン生成装置1は、繰り返し正規表現を含む正規表現が与えられた場合に、その正規表現を変換した1文字単位のNFAにおいて、繰り返し正規表現に対応する状態遷移を、繰り返し回数分の基本要素の連接に展開せず、必要最小限の状態数で構成される状態遷移に置き換えた上で、1文字単位のNFAから複数文字単位のNFAへの変換を行う。
 正規表現を表現する1文字単位のNFAや複数文字単位のNFAの状態数が繰り返し正規表現の繰り返し回数に比例せず、繰り返し正規表現の個数に比例するため、繰り返し正規表現を含む正規表現において繰り返し正規表現の繰り返し回数が多くなった場合でも、正規表現を表現する1文字単位のNFAや複数文字単位のNFAの状態数を小さく抑えることが可能である。
 また、1文字単位のNFAの状態数を少なく抑えることができるため、結果的に1文字NFAから多文字NFAへの変換時の演算量を小さく抑えることができる。
 さらに、1文字単位のNFAにおいて繰り返し正規表現に対応する状態遷移を必要最小限の状態数で構成される状態遷移に置き換える際に、置き換えたNFAの状態番号を繰り返し正規表現に関する情報として、1文字単位のNFAから複数文字単位のNFAへの変換を行う前に保持しておき、1文字単位のNFAから複数文字単位のNFAへの変換を行う際に状態番号の変化を伴わない変換部を用い、複数文字単位のNFAへの変換後に、あらかじめ保持しておいた繰り返し正規表現に対応する状態遷移に対応するNFAの状態番号を参照して、複数文字単位の繰り返し正規表現に変換しているため、1文字単位のNFAを複数文字単位のNFAに変換した後においても、繰り返し正規表現が存在する位置を特定することができる。
 さらに、複数文字単位のNFAに変換した後においても、繰り返し正規表現が存在する位置を特定することができるため、1クロックサイクルに複数文字を処理できるNFA回路を構成する際に、複数文字単位の繰り返し正規表現に対応するNFA回路として、効率のよい、例えば必要なハードウェア資源が少ない、NFA回路構成などを用途に応じて選択して適用することができる。
 上記の実施の形態の説明では、繰り返し文字は‘A’、‘B’といった単一文字を例に説明したが、マッチする文字の長さが1文字の正規表現であればどのような正規表現を繰り返し文字として指定しても良い。例えば、“(A|B)”や“[A-Za-z0-9]”など複数文字のいずれかを表す正規表現を繰り返し正規表現の繰り返し文字として指定することもできる。
 以上、説明した本発明の第1の実施の形態では、以下のような効果を得ることができる。第1の効果は、繰り返し正規表現を含む正規表現において繰り返し正規表現の繰り返し回数が多くなった場合でも、正規表現を表現する1文字単位のNFAや複数文字単位のNFAの状態数や、1文字NFAから多文字NFAへの変換時の演算量を小さく抑えることができることである。
 その理由は、繰り返し正規表現を含む正規表現が与えられた場合に、その正規表現を変換した1文字単位のNFAにおいて、繰り返し正規表現に対応する状態遷移を、繰り返し回数分の基本要素の連接に展開せず、必要最小限の状態数で構成される状態遷移に置き換えた上で、1文字単位のNFAから複数文字単位のNFAへの変換を行うためである。また、複数文字単位のNFAを生成した後、複数文字単位の繰り返し正規表現を含む状態遷移を再生する際にも、繰り返し正規表現に関連する状態間の関係を参照することで、状態数の増加を動作文字数の2倍程度に抑える変換方法を採用しているため、複数文字単位のNFAの状態数の増加を小さく抑えることができる。
 第2の効果は、1文字単位のNFAを複数文字単位のNFAに変換した後においても、繰り返し正規表現が存在する位置を特定できることである。
 その理由は、1文字単位のNFAにおいて繰り返し正規表現に対応する状態遷移を必要最小限の状態数で構成される状態遷移に置き換える際に、置き換えたNFAの状態番号を繰り返し正規表現に関する情報として、1文字単位のNFAから複数文字単位のNFAへの変換を行う前に保持しておき、1文字単位のNFAから複数文字単位のNFAへの変換を行う際に状態番号の変化を伴わない変換部を用い、複数文字単位のNFAへの変換後に、あらかじめ保持しておいた繰り返し正規表現に対応する状態遷移に対応するNFAの状態番号を参照して、複数文字単位の繰り返し正規表現に変換しているためである。
 第3の効果は、1クロックサイクルに複数文字を処理できるNFA回路において、繰り返し正規表現に対応するNFA回路として効率のよいNFA回路構成を適用することが可能な点である。
 その理由は、第2の効果により、1文字単位のNFAを複数文字単位のNFAに変換した後においても、繰り返し正規表現が存在する位置を特定できるため、1クロックサイクルに複数文字を処理できるNFA回路を構成する際に、複数文字単位の繰り返し正規表現に対応するNFA回路として効率のよいNFA回路構成を選択して適用することができるためである。
 なお、一般に、有限オートマトン(FA、Finite Automaton)にはNFA(非決定性有限オートマトン)とDFA(決定性有限オートマトン、Deterministic Finite Automaton)の2種類に分類される。上記の本発明の実施の形態はNFAを用いて説明したが、本実施の形態と同様の構成をDFAに対して適用することもができる。具体的には、1文字NFA生成手段121において、1文字単位のNFAを生成する代わりに1文字単位のDFAを生成し、1文字単位のDFAを生成する際に繰り返し正規表現に対応する状態遷移の開始状態番号を保持するようにすれば、NFAに限らずDFAに対しても、行列サイズの小さな縮小版の記述行列を用いて、同時に複数文字を処理できるM文字単位のDFAを生成することができる。この場合の有限オートマトン生成装置の構成は、ここまでで説明したものと同一で、ただ「NFA」を「DFA」に読み替えるだけでよい。
[第2の実施の形態]
 図18は本発明の第2の実施の形態に係る有限オートマトン生成装置401の構成を示すブロック図である。有限オートマトン生成装置401は、第1の実施の形態に係る有限オートマトン生成装置1と同様に、入力装置411、データ処理装置418、記憶装置414、出力装置413を備える。データ処理装置418は、CPU、RAM、OSなどによって構成されるコンピュータ装置の中心部であり、プログラムを実行する主体である。
 本実施の形態においては、第1の実施の形態のデータ処理装置12における1文字NFA生成部21、多文字NFA変換前処理部22、多文字NFA変換部23、多文字NFA変換後処理部24、およびHDL変換部25に相当する処理を、データ処理装置418で実行される正規表現―HDL変換プログラム415で実現したものである。
 正規表現―HDL変換プログラム415は、データ処理装置418に読み込まれ、データ処理装置418の動作を制御し、記憶装置414内に繰り返し正規表現記憶部431、1文字NFA記憶部432、変換用1文字NFA記憶部433、変換用多文字NFA記憶部434、多文字NFA記憶部435を生成する。各々の機能は、前述した第1の実施の形態のデータ処理装置12における同名の機能部と各々同一となっている。
 データ処理装置418は、正規表現―HDL変換プログラム415の制御により、第1の実施の形態におけるデータ処理装置12による処理と同一の処理を行うことができ、同一の効果を得ることができる。
 なお、第2の実施の形態も、第1の実施の形態と同様に、NFAに限らずDFAに対しても適用することが可能である。その他の構成および作用効果については、前述した第1の実施の形態と同一である。
[第3の実施の形態]
 図19は本発明の第3の実施の形態に係る有限オートマトン生成装置501の構成を示すブロック図である。有限オートマトン生成装置501は、本発明の第1の実施の形態に係る有限オートマトン生成装置1の構成に加えて、FPGA等の再構成可能なハードウェアデバイスにその構成をコンフィグレーションするためコンフィグレーション装置541、パターンマッチングの対象となるデータパターンマッチング装置に入力する入力装置550と、FPGA等の再構成可能なハードウェアデバイスを有するパターンマッチング装置560と、パターンマッチングの結果を出力するためのディスプレイ装置や印刷装置等の出力装置570を備える。これら以外の構成および作用効果については、前述した第1の実施の形態と同一である。
 データ処理装置516は、図1に示した第1の実施の形態のデータ処理装置12に、コンフィグレーションデータ変換部526を加えたものである。その他は、前記第1の実施の形態と同じである。また、記憶装置514は、図1に示した第1の実施の形態の記憶装置14内の各々の記憶部の他に、HDL記憶部536が記憶されている。HDL記憶部536には、HDL変換部25によって変換されたHDL回路記述が記憶される。
 コンフィグレーションデータ変換部526は、HDL変換部25から正規表現からHDL回路記述への変換が完了したことを示す信号を受け取ると、HDL変換部25から受信した多文字NFAを記述するHDL回路記述から、パターンマッチング装置560が有する再構成可能なハードウェアデバイスの構成情報となるコンフィグレーションデータへ変換し、変換が終了すると、コンフィグレーション装置541に出力する。なお、HDL回路記述からコンフィグレーションデータへの変換については、例えばFPGAであれば、そのベンダーが提供している開発ツールを使用することができる。
 コンフィグレーション装置541は、コンフィグレーションデータ変換部526からコンフィグレーションデータを受信すると、パターンマッチング装置560のパターンマッチング部562を実現する再構成可能なハードウェアデバイスを構成・設定する。
 コンフィグレーション装置541は、FPGA等の再構成可能なハードウェアデバイスにその構成をコンフィグレーションするための制御プログラムや、ハードウェアデバイスにデータを転送するための書き込みケーブルなどで構成され、これらの構成要素は、例えばFPGAであれば、デバイスベンダーが提供している開発ツールに含まれる。コンフィグレーションデータを用いて再構成可能なハードウェアデバイスを構成・設定する詳細な手順については、FPGAなどのデバイスベンダーの提供する開発ツールを使用する。
 パターンマッチング装置560は、データ入力部561と、パターンマッチング部562と、結果出力部563とを備えている。データ入力部561、パターンマッチング部562、結果出力部563は、別々の再構成可能なハードウェアデバイス上に構成されるものとする。
 データ入力部561は、データ入力装置174から入力されたパケットデータや、テキストデータ等のパターンマッチング対象データ(これを被検索データと呼ぶ)を整形し、データ処理装置516で生成された同時動作数に等しい同時処理文字数に並列化し、前記同時処理文字数単位に被検索データをパターンマッチング部562へ入力する。
 パターンマッチング部562は、コンフィグレーション装置541を経由して入力された、データ処理装置16で生成したコンフィグレーションデータにより構成される回路であり、データ処理装置16にて生成した多文字NFA回路そのものである。
 パターンマッチング部562に構成されたNFA回路は、データ入力部561から被検索データが入力されるたびに状態遷移が起こり、パターンに一致した場合にはその信号が終了状態を構成しているレジスタからパターンに一致した旨を示す信号とパターンに一致した被検索データに関する情報(例えば、パターンに一致した被検索データの位置など)が結果出力部563へと出力される。
 結果出力部563は、パターンマッチング部562から入力されたパターンに一致したことを示す信号とパターンに一致した被検索データに関する情報を受け取る。結果出力部563は、入力された被検索データがどの入力文字列でどのパターンに一致したのか等の情報を処理して、結果出力装置175へ出力する。なお、どのパターンに一致したかは、予め定義しておいたパターン番号等により通知するといった方法がある。
 本実施の形態では、正規表現そのものを入力することで、1文字NFAから指定された処理文字数で遷移を行う多文字NFAの変換を行い、そのNFA回路を記述するHDL記述を生成した後に、HDL記述により記述されたNFA回路をパターンマッチング装置内のハードウェアデバイス上に構成し、それを用いたパターンマッチング装置を実現することができる。
 第1の実施の形態の説明において述べたように、本発明では1文字単位のNFAの状態数を少なく抑えることができるため、結果的に1文字NFAから多文字NFAへの変換時の演算量を小さく抑えることができるため、正規表現が入力されてからM文字単位のNFAを得て、最終的に指定された正規表現を検索する回路のHDL記述を得るための所用時間を削減することができる。
 そのため、入力装置11より新たな正規表現が入力された際に、短い時間で多文字NFA回路を記述したHDL回路記述を得ることができるため、そのNFA回路を記述したHDL回路記述を変換したコンフィグレーションデータを短い時間で得ることができ、入力装置11より新たな正規表現が入力されてからその正規表現がパターンマッチング部562の構成を反映されるまでの時間を短縮することができる。
 また、複数文字単位のNFAに変換した後においても、繰り返し正規表現が存在する位置を特定することができるため、1クロックサイクルに複数文字を処理できるNFA回路を構成する際に、複数文字単位の繰り返し正規表現に対応するNFA回路として、例えばNFA回路構成などを用途に応じて選択して適用することができる。
 このため、繰り返し正規表現の繰り返し回数が非常に大きい場合であっても、必要なハードウェア資源が少なく、多数の正規表現を収容可能なNFA回路を構成することが可能となり、パターンマッチング装置において照合可能なパターン数の増加を図ることが可能となる。
 なお、第2の実施の形態における正規表現-HDL変換プログラム415で制御されるデータ処理装置で生成された多文字NFAを記述するHDL回路記述を、コンフィグレーションデータ変換部526に入力し、前記HDL回路記述からコンフィグレーションデータを生成してもよい。
 さらに、本実施の形態では、パターンマッチング装置560において、データ入力部561と、パターンマッチング部562と、結果出力部563は別々の再構成可能ハードウェアデバイス上に構成されるとしたが、これら3つを同じ再構成可能ハードウェアデバイス上に構成してもよい。
 また、例えばデータ入力部561と結果出力部563を同じ再構成可能ハードウェアデバイス上に、パターンマッチング部562を別の再構成可能ハードウェアデバイス上に構成する等、データ入力部561と、パターンマッチング部562と、結果出力部563と、これらを配備する再構成可能ハードウェアデバイスの関係には制約はない。
 また、データ入力部561と結果出力部563については、ASIC(Application Specific Integrated Circuit)などの再構成できないハードウェアデバイスに構成することもできる。また、ハードウェアデバイスの一部のみが再構成可能であり、他の部分は再構成できないハードウェアデバイスを用いて、パターンマッチング部562を再構成可能な部分に、データ入力部561と結果出力部563を再構成できないハードウェアデバイスとして構成してもよい。
 ここで、データ入力部561、結果出力部563の両方、または、いずれかを、パターンマッチング部562と同じ再構成可能ハードウェアデバイス上に構成する場合、コンフィグレーションデータ変換部526は、HDL変換部25にて生成されたNFA回路を記述するHDL回路記述のみでなく、データ入力部561や結果出力部563の回路を記述するHDL回路記述も読み込んでコンフィグレーションデータを生成することにより対応できる。
 上記の実施の形態の動作の説明では、コンフィグレーション装置541はコンフィグレーションデータ変換部526からコンフィグレーションデータを受信すると、受信したコンフィグレーションデータを使用して、パターンマッチング装置560のパターンマッチング部562を実現する再構成可能なハードウェアデバイスを構成・設定するとしたが、コンフィグレーション装置541に記憶装置を配備し、いったん受信したコンフィグレーションデータをコンフィグレーション装置541に配備した記憶装置内に記憶させた後、記憶装置内からコンフィグレーションデータを読み出して、パターンマッチング装置560のパターンマッチング部562を実現する再構成可能なハードウェアデバイスを構成・設定してもよい。
 また、上記の実施の形態の動作の説明では、コンフィグレーション装置541は、コンフィグレーションデータ変換部526からコンフィグレーションデータを受信するとパターンマッチング部562を実現する再構成可能なハードウェアデバイスの構成を開始するとしたが、コンフィグレーションデータ変換部526からコンフィグレーションデータを受信した際にパターンマッチング部562を実現する再構成可能なハードウェアデバイスの構成を開始する必要はなく、コンフィグレーション装置541に記憶装置を配備し、コンフィグレーションデータ変換部526から受信したコンフィグレーションデータをコンフィグレーション装置541に配備した記憶装置内に記憶された後、パターンマッチング装置560のパターンマッチング部562の動作状況を考慮し、パターンマッチング装置560のパターンマッチング部562の動作に都合のよいタイミングでパターンマッチング部562を実現する再構成可能なハードウェアデバイスの構成を開始してもよい。
 なお、第3の実施の形態も、第1、第2の実施の形態と同様に、NFAに限らずDFAに対しても適用することが可能である。
 これまで本発明について図面に示した特定の実施の形態をもって説明してきたが、本発明は図面に示した実施の形態に限定されるものではなく、本発明の効果を奏する限り、これまで知られたいかなる構成であっても採用することができる。
 この出願は2008年8月13日に出願された日本出願特願2008-208481を基礎とする優先権を主張し、その開示の全てをここに取り込む。
 本発明の活用例として、正規表現を用いたパターンマッチング処理を行うためのNFA回路を記述したHDL生成システム、生成プログラムといった用途に適用できる。また、本発明を用いて生成したHDLによりNFA回路を構成することで、正規表現を用いた高速なパターンマッチング処理を行うためのパターンマッチング装置といった用途に適用できる。
 さらに、パターンマッチング装置にパケット処理回路を加えることにより、ネットワーク侵入検知システム(NIDS: Network Intrusion Detection System)やネットワーク侵入防止システム(NIPS:
Network Intrusion Prevention System)、あるいはコンピュータウィルス検出システムなどにも適用でき、パソコンやワークステーションに搭載されているソフトウェアベースでのパターンマッチング処理の代替となるハードウェアアクセラレータ用NFA回路生成システム、生成プログラム、及び、正規表現検索ハードウェアアクセラレータ装置等にも適用できる。
本発明の第1の実施の形態に係る有限オートマトン生成装置1の構成を示すブロック図である。 非特許文献4のp.111にて開示されている、正規表現“BCD((A{100}|E)S)*TU”を、繰り返し正規表現を認識しつつ構文木に変換した結果を示す概念図である。 図2に示した構文木から得られる1文字NFAを示す遷移図である 図1に示した正規表現情報記憶部に記憶される繰り返し正規表現情報リストの一例を示す表である。 図1で示した多文字NFA変換前処理部の動作を示すフローチャートである。 図5のステップS102として示した繰り返し正規表現の多文字変換用の状態遷移への置き換えの詳細を示すフローチャートである。 図5のステップS102まで完了した時点で得られた変換用1文字NFAを示す遷移図である。 図5のステップS102まで完了した時点での繰り返し正規表現記憶部に保持されている繰り返し正規表現情報リストを示す概念図である 図5のステップS103のε-クロージャ処理を行った後の変換用1文字NFA記憶部に記憶されている変換用1文字NFAを示す遷移図である。 図5のステップS103まで完了した時点での、繰り返し正規表現記憶部に保持されている繰り返し正規表現情報リストを示す概念図である。 図1に示す多文字NFA変換部による変換処理により生成され、変換用多文字NFA記憶部に格納された変換用多文字NFAを示す遷移図である 図1に示した多文字NFA変換後処理部が、変換用多文字NFA記憶部に保持された変換用多文字NFAに含まれる多文字変換用の状態遷移を、M文字単位の繰り返し正規表現に置き換える処理の詳細を示すフローチャートである。 図12のステップS303に示したコピー状態の生成まで行った時点での多文字NFAを示す遷移図である。 図12のステップS304の処理まで完了した時点での多文字NFAを示す遷移図である。 多文字NFA変換後処理部の動作の説明に用いている、繰り返し正規表現情報リストの1個目のエントリーに対する図12のステップS305の動作を説明する概念図である。 図12のステップS306において割り当てられたM文字単位の繰り返し正規表現を、図14の多文字NFAに追加したものを示す遷移図である。 4文字単位の繰り返し正規表現“AAAA{24}”を構成するためのNFA回路構成例を示す概念図である。 本発明の第2の実施の形態に係る有限オートマトン生成装置の構成を示すブロック図である。 本発明の第3の実施の形態に係る有限オートマトン生成装置の構成を示すブロック図である。 非特許文献3に記載の方法で、繰り返し正規表現を含む正規表現“BCDA{93}STU”を基本パターンの組み合わせに展開した1文字NFAを示す概念図である。 図20と同じ方法で同じ正規表現を表現したNFA変換行列を示す概念図である。
 1、401、501 有限オートマトン生成装置
 11、411 入力装置
 12、418、516 データ処理装置
 13、413 出力装置
 14、414、514 記憶装置
 21 1文字NFA生成部
 22 多文字NFA変換前処理部
 23 多文字NFA変換部
 24 多文字NFA変換後処理部
 25 HDL変換部
 31、431 繰り返し正規表現記憶部
 32、432 1文字NFA記憶部
 33、433 変換用1文字NFA記憶部
 34、434 変換用多文字NFA記憶部
 35、435 多文字NFA記憶部
 415 正規表現-HDL変換プログラム
 526 コンフィグレーションデータ変換部
 536 HDL記憶部
 541 コンフィグレーション装置
 550 入力装置
 560 パターンマッチング装置
 561 データ入力部
 562 パターンマッチング部
 563 結果出力部
 570 出力装置

Claims (10)

  1.  入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、前記1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行う有限オートマトン生成装置であって、
     前記正規表現および前記有限オートマトンの遷移条件に係る動作文字数の入力を受け付ける入力装置と、
     前記正規表現に基づいて第1の1文字FAを生成する1文字FA生成部と、
     前記動作文字数に基づいて前記第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成する多文字変換前処理部と、
     前記多文字変換前処理部によって変換された第2の1文字FAから、前記動作文字数に基づいて第1の多文字FAを生成する多文字FA変換部と、
     前記多文字FA変換部によって生成された第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を前記動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成する多文字変換後処理部と、を有することを特徴とする有限オートマトン生成装置。
  2.  前記多文字変換前処理部が、前記第1の1文字FAに含まれる、繰り返し正規表現の繰り返し回数が前記動作文字数より大きい繰り返し正規表現を表す状態遷移を、前記動作文字数によって決定される繰り返し回数の繰り返し正規表現を表す状態遷移に置換することで第2の1文字FAを生成することを特徴とする、請求項1に記載の有限オートマトン生成装置。
  3.  前記多文字変換後処理部が、前記第1の多文字FAに含まれる、前記繰り返し正規表現に対応する多文字変換用の状態遷移を、前記動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えるための変換手順が、前記繰り返し正規表現の繰り返し文字数と前記動作文字数により決定されることを特徴とする、請求項2に記載の有限オートマトン生成装置。
  4.  前記多文字変換後処理部に、前記第2の多文字FAに基づいて回路記述を生成するHDL変換部が併設されていることを特徴とする、請求項1に記載の有限オートマトン生成装置。
  5.  前記HDL変換部に、予め別に設けられたパターンマッチング装置の主要部であり、入力データに対してパターンマッチング処理を行うパターンマッチング部を前記回路記述に基づいて形成するコンフィグレーション装置が併設されていることを特徴とする、請求項4に記載の有限オートマトン生成装置。
  6.  入力データに対してパターンマッチング処理を行うパターンマッチング装置であって、
     前記入力データを受け付けるデータ入力部と、前記パターンマッチング処理の結果を出力する結果出力部とを備え、
     前記データ入力部と前記結果出力部との間に前記入力データに対してパターンマッチング処理を行うパターンマッチング部を設け、このパターンマッチング部の動作内容が請求項5に記載の有限オートマトン生成装置によって生成された回路記述に基づいて特定されることを特徴とするパターンマッチング装置。
  7.  入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、前記1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行う有限オートマトン生成方法であって、
     前記正規表現および当該正規表現に係る動作文字数の入力を受け付け、
     前記正規表現に基づいて第1の1文字FAを生成し、
     前記動作文字数に基づいて前記第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成し、
     前記第2の1文字FAから前記動作文字数に基づいて第1の多文字FAを生成し、
     前記第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を前記動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成することを特徴とする有限オートマトン生成方法。
  8.  前記第2の多文字FAを出力する処理は、前記第1の多文字FAに含まれる、前記繰り返し正規表現に対応する多文字変換用の状態遷移を、あらかじめ定められた演算ルールに基づき、前記指定された任意の動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えることを特徴とする、請求項7に記載の有限オートマトン生成方法。
  9.  前記第1の1文字FAを第2の1文字FAに変換する処理は、前記第1の1文字FAに含まれる、繰り返し正規表現の繰り返し回数が前記動作文字数より大きい繰り返し正規表現を表す状態遷移を、前記指定された任意の動作文字数より決定される繰り返し回数の繰り返し正規表現を表す状態遷移に置換することで、第2の1文字FAを生成することを特徴とする、請求項7に記載の有限オートマトン生成方法。
  10.  入力された正規表現を、1文字単位の遷移条件を持つ有限オートマトン(FA)に変換し、前記1文字単位の遷移条件を持つ有限オートマトンから指定された任意の文字数の遷移条件を持つ有限オートマトンへの変換を行う有限オートマトン生成装置を制御するコンピュータに、
     前記正規表現および当該正規表現に係る動作文字数の入力を受け付ける処理と、
     前記正規表現に基づいて第1の1文字FAを生成する処理と、
     前記動作文字数に基づいて前記第1の1文字FAに含まれる繰り返し正規表現を表す状態遷移を多文字変換用の状態遷移に置換して第2の1文字FAを生成する処理と、
     前記第2の1文字FAから前記動作文字数に基づいて第1の多文字FAを生成する処理と、
     前記第1の多文字FA中の繰り返し正規表現に対応する多文字変換用の状態遷移を前記動作文字数単位の繰り返し正規表現を表す状態遷移に置き換えて第2の多文字FAを生成する処理とを実行させることを特徴とする有限オートマトン生成プログラム。
PCT/JP2009/060985 2008-08-13 2009-06-17 有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム WO2010018710A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010524682A JP5321589B2 (ja) 2008-08-13 2009-06-17 有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2008-208481 2008-08-13
JP2008208481 2008-08-13

Publications (1)

Publication Number Publication Date
WO2010018710A1 true WO2010018710A1 (ja) 2010-02-18

Family

ID=41668857

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/060985 WO2010018710A1 (ja) 2008-08-13 2009-06-17 有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム

Country Status (2)

Country Link
JP (1) JP5321589B2 (ja)
WO (1) WO2010018710A1 (ja)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013534660A (ja) * 2010-06-10 2013-09-05 マイクロン テクノロジー, インク. 状態情報を提供するためのプログラム可能装置、階層型並列マシン、方法
JP2013246720A (ja) * 2012-05-28 2013-12-09 Fujitsu Ltd 入力文字列確認装置
JP2014506693A (ja) * 2011-01-25 2014-03-17 マイクロン テクノロジー, インク. オートマトンの入次数および/または出次数を制御するための数量化の展開
JP2014506692A (ja) * 2011-01-25 2014-03-17 マイクロン テクノロジー, インク. Fsmを実装するための専用要素の利用
JP2014095993A (ja) * 2012-11-08 2014-05-22 Mitsubishi Electric Corp 情報処理装置及び情報処理方法及びプログラム
US9104828B2 (en) 2011-01-25 2015-08-11 Micron Technology, Inc. State grouping for element utilization
US9146714B2 (en) 2011-01-25 2015-09-29 Micron Technology, Inc. Method and apparatus for compiling regular expressions
US9379005B2 (en) 2010-06-28 2016-06-28 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US9405652B2 (en) 2013-10-31 2016-08-02 Red Hat, Inc. Regular expression support in instrumentation languages using kernel-mode executable code
US9785847B2 (en) 2010-06-10 2017-10-10 Micron Technology, Inc. Analyzing data using a hierarchical structure
US10586802B2 (en) 2011-02-25 2020-03-10 Micron Technology, Inc. Charge storage apparatus and methods

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008081932A1 (ja) * 2006-12-28 2008-07-10 Nec Corporation 文字列照合用有限オートマトン生成システム、その生成方法、及び生成プログラム
JP4957500B2 (ja) * 2007-10-12 2012-06-20 日本電気株式会社 文字列照合回路
JP5429164B2 (ja) * 2008-06-04 2014-02-26 日本電気株式会社 有限オートマトン生成システム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
NORIO YAMAGAKI ET AL.: "NFA Umekomigata Pattern Matching Kairo ni Okeru Multibyte Shorika ni Kansuru Kento", IEICE TECHNICAL REPORT, THE INSTITUTE OF ELECTRONICS, INFORMATION AND COMMUNICATION ENGINEERS, vol. 107, no. 225, 13 September 2007 (2007-09-13), pages 65 - 70 *

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013534660A (ja) * 2010-06-10 2013-09-05 マイクロン テクノロジー, インク. 状態情報を提供するためのプログラム可能装置、階層型並列マシン、方法
US11604687B2 (en) 2010-06-10 2023-03-14 Micron Technology, Inc. Programmable device, hierarchical parallel machines, and methods for providing state information
US11488378B2 (en) 2010-06-10 2022-11-01 Micron Technology, Inc. Analyzing data using a hierarchical structure
US11003515B2 (en) 2010-06-10 2021-05-11 Micron Technology, Inc. Programmable device, hierarchical parallel machines, and methods for providing state information
US10191788B2 (en) 2010-06-10 2019-01-29 Micron Technology, Inc. Programmable device, heirarchical parallel machines, and methods for providing state information
US9785847B2 (en) 2010-06-10 2017-10-10 Micron Technology, Inc. Analyzing data using a hierarchical structure
US11700730B2 (en) 2010-06-28 2023-07-11 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US10872903B2 (en) 2010-06-28 2020-12-22 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US10510769B2 (en) 2010-06-28 2019-12-17 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US9379005B2 (en) 2010-06-28 2016-06-28 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US10090324B2 (en) 2010-06-28 2018-10-02 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US9780115B2 (en) 2010-06-28 2017-10-03 Micron Technology, Inc. Three dimensional memory and methods of forming the same
US9792097B2 (en) 2011-01-25 2017-10-17 Micron Technology, Inc. Method and apparatus for compiling regular expressions
US9916145B2 (en) 2011-01-25 2018-03-13 Micron Technology, Inc. Utilizing special purpose elements to implement a FSM
US9471290B2 (en) 2011-01-25 2016-10-18 Micron Technology, Inc. Utilizing special purpose elements to implement a FSM
US10089086B2 (en) 2011-01-25 2018-10-02 Micron Technologies, Inc. Method and apparatus for compiling regular expressions
US9146714B2 (en) 2011-01-25 2015-09-29 Micron Technology, Inc. Method and apparatus for compiling regular expressions
US9104828B2 (en) 2011-01-25 2015-08-11 Micron Technology, Inc. State grouping for element utilization
JP2014506692A (ja) * 2011-01-25 2014-03-17 マイクロン テクノロジー, インク. Fsmを実装するための専用要素の利用
JP2014506693A (ja) * 2011-01-25 2014-03-17 マイクロン テクノロジー, インク. オートマトンの入次数および/または出次数を制御するための数量化の展開
US10586802B2 (en) 2011-02-25 2020-03-10 Micron Technology, Inc. Charge storage apparatus and methods
US11581324B2 (en) 2011-02-25 2023-02-14 Micron Technology, Inc. Charge storage apparatus and methods
JP2013246720A (ja) * 2012-05-28 2013-12-09 Fujitsu Ltd 入力文字列確認装置
JP2014095993A (ja) * 2012-11-08 2014-05-22 Mitsubishi Electric Corp 情報処理装置及び情報処理方法及びプログラム
US9405652B2 (en) 2013-10-31 2016-08-02 Red Hat, Inc. Regular expression support in instrumentation languages using kernel-mode executable code

Also Published As

Publication number Publication date
JPWO2010018710A1 (ja) 2012-01-26
JP5321589B2 (ja) 2013-10-23

Similar Documents

Publication Publication Date Title
JP5321589B2 (ja) 有限オートマトン生成装置、パターンマッチング装置、有限オートマトン回路生成方法およびプログラム
EP2668577B1 (en) Unrolling quantifications to control in-degree and/or out degree of automaton
KR101698237B1 (ko) 계층적 구조를 이용한 데이터 분석
KR101640295B1 (ko) 정규 표현을 컴파일하기 위한 방법 및 장치
EP2791781B1 (en) Methods and systems for data analysis in a state machine
WO2009116646A1 (ja) マルチバイト処理向け文字列照合用有限オートマトン生成システム
KR101606622B1 (ko) Fsm을 구현하기 위한 특수 목적 요소의 이용
JP6017034B2 (ja) 状態機械エンジンが受信したデータを取り扱うための方法およびシステム
JP5381710B2 (ja) ε遷移を含まない非決定性有限オートマトン生成システムと方法およびプログラム
JP2014506693A5 (ja)
KR102165134B1 (ko) 상태 기계 엔진에서 상태 벡터 데이터를 사용하기 위한 방법들 및 시스템들
WO2010107114A1 (ja) パターンマッチング装置
Heule et al. Expressing symmetry breaking in DRAT proofs
JP2013525892A (ja) ラージ・スケール正規表現のマッチングのための二重dfa分解
Lewandowski et al. A novel method for watermarking sequential circuits
JP2974900B2 (ja) 自律進化型ハードウェア設計システム
Kaneta et al. Dynamic reconfigurable bit-parallel architecture for large-scale regular expression matching
Fayyazi et al. Deep learning-based circuit recognition using sparse mapping and level-dependent decaying sum circuit representations
JP4403187B2 (ja) 設計データ変換プログラム、該プログラムを記録した記録媒体、設計データ変換装置、および設計データ変換方法
Nilsen et al. A variable word-width content addressable memory for fast string matching
JP5429164B2 (ja) 有限オートマトン生成システム
Kaneta et al. High-speed string and regular expression matching on FPGA
Berglund Analyzing and pumping hyperedge replacement formalisms in a common framework
Kumar et al. Realization of incompletely specified functions in minimized reversible cascades
Schaefer et al. DESIJ--Enabling Decomposition-Based Synthesis of Complex Asynchronous Controllers

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09806606

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2010524682

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09806606

Country of ref document: EP

Kind code of ref document: A1