A software component that takes input data (frequently text) and builds a data structure – often some kind of parse tree, abstract syntax tree or other hierarchical structure - giving a structural representation of the input while checking for correct syntax according to a formal grammar.
"Parsers are used in compilers to analyze source code and in web browsers to interpret HTML and CSS into visual web pages."