Don't miss an insight. Subscribe to Techopedia for free.

Subscribe
Advertisement

Parser

Reviewed by Margaret RouseCheckmark | Last updated: December 20, 2022

What Does Parser Mean?

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

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.

Advertisement

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.

Advertisement

Share this Term

  • Facebook
  • LinkedIn
  • Twitter

Related Reading

Tags

Software DevelopmentComputer ScienceTech 101DevOps

Trending Articles

Go back to top