Parser

Why Trust Techopedia

What Does Parser Mean?

A parser is the part of a compiler that breaks source code into small sections of character strings called tokens.

Advertisements

The term has its roots in linguistics. In linguistics, parsing involves physically diagraming the underlying structure of a sentence. The purpose is to help the learner understand the context of each sentence element and its relationship to the meaning of the sentence.

In computing, parsers create logical diagrams called trees. The purpose is to help the compiler understand the context of each token and its relationship to the underlying structure of the source code.

Parsers are widely used in the following technologies:

  • Java and other programming languages.

  • HTML and XML.

  • Database languages such as SQL.

  • Modeling languages, such as virtual reality modeling language (VRML).

  • Scripting languages such as Javascript.

  • Protocols, such as HTTP.

Techopedia Explains Parser

The technical process of parsing has three stages:

  1. Lexical Analysis: produces tokens from a stream of input characters. A token is the smallest unit in a programming language that possesses some meaning (such as +, -, *, “function”, or “new” in JavaScript).

  2. Syntactic Analysis: checks to see if the generated tokens form a meaningful expression.

  3. Semantic Parsing: uses syntax trees and symbol look-up tables to determine whether the generated tokens are semantically consistent with a specific programming language.

Parsing can be conducted in either a top-down or bottom-up manner.

  • Top-Down Parsing: Parsing begins with the start symbol and trees are built from root to leaves. Top-down parsing is also called predictive parsing or recursive parsing.

  • Bottom-Up Parsing: Trees are built from leaves to root and ends with the start symbol. This type of parsing is also known as shift-reduce parsing.

Advertisements

Related Terms

Margaret Rouse
Technology Specialist
Margaret Rouse
Technology Specialist

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.