Patent ID: 7636787

Claim:
A parser for parsing a text-coded protocol, comprising: a parsing rule storage module, configured to store a parsing rule tree generated according to Augmented Backus-Naur Form (ABNF) rules for parsing a packet of the text-coded protocol; and a packet parsing module, implemented by a logic chip, configured to parse the packet according to the parsing rule tree stored in the parsing rule storage module, and output a parsing result, wherein the parsing rule tree comprises no incremental selection, sequence group and optional sequence structure, and wherein the parsing rule tree is generated in a recursion mode by taking one rule in the parsing rule tree as a vertex, wherein the packet parsing module comprises a main_proc processing unit, configured to control entering of a parse_term_proc processing unit, a match_first_proc, processing unit and a match_follow_proc processing unit respectively according to a type of a top node of a stack; the parse_term_proc processing unit, configured to be started under the control of the main_proc processing unit if the top node is a terminative node, inform the main_proc processing unit after parsing the packet; the match_first_proc processing unit, configured to be started under the control of the main_proc processing unit if the top node is a non-terminative node and belongs to a First Terminals Set, and inform the main_proc processing unit after determining whether a current character belongs to the First Terminals Set by matching the current character with all characters of the First Terminals Set; the match_follow_proc processing unit, configured to be started under the control of the main_proc processing unit if the top node is a non-terminative node and belongs to a Follow Terminals Set, and inform the main_proc processing unit after determining whether the current character belongs to the Follow Terminals Set by matching the current character with all characters of the Follow Terminals Set.