1. A computer-implemented system for application protocol field extraction, comprising: an extraction specification that specifies data elements to be extracted from data packets and is expressed in terms of a context-free grammar, where the grammar defines grammatical structures of data packets transmitted in accordance with an application protocol and is defined as a tuple having nonterminals, terminals, counters, production rules and a start nonterminal, such that the counters are variables with an integer value used to chronicle parsing history of the production rules, and at least one of the production rules includes an action association with a terminal or nonterminal comprising body of the production rule and the action is an expression for updating a value of a counter defined by the grammar; an automata generator configured to receive the extraction specification and generate a counting automaton; and a field extractor configured to receive a data flow comprised of a plurality of data packets traversing through a network and extract data elements from the data packets in accordance with the counting automaton, where the field extractor is implemented by an integrated circuit.