1. A matching device comprising: a parse-tree building unit that builds a parse tree based on an event pattern, the event pattern including a first pattern of a single event, a second pattern where every event of a plurality of events occurs in no particular order, and a third pattern where any one event of a plurality of events occurs, and representing an occurrence order of the first pattern, the second pattern, and the third pattern, by associating an event node corresponding to each event, an AND node representing a relationship between the events in the second pattern, and an OR node representing a relationship between the events of the third pattern together in a tree structure; an automaton building unit that builds an automaton by performing a process of joining child nodes of the AND node in parallel to the AND node and a process of joining child nodes of the OR node in parallel to the OR node while traversing the parse tree; and a matching unit that performs matching of determining whether an event stream that includes a plurality of event occurrence orders includes the event pattern by comparing the event stream with the automaton in succession, causing a transition to the AND node of the automaton to start after transitions from all transition source nodes which transit to the AND node have been invoked, and causing a transition to the OR node of the automaton to start after a transition from any one of transition source nodes which transit to the OR node has been invoked.