Typically, the code to implement a parser is generated using a tool rather than hand written. Tools that have been used for the task of parsing XQuery are ANTLR [7] and REx [8].

REx has the valuable feature that its input format is EBNF. EBNF is the grammar language used in the XQuery standards. REx can also output parser code in many languages, including XQuery 1.0 and Javascript.