0 votes
73 views
In computer technology i have heard of parsers.But what actually is parser ? Why are they so important..
asked Jun 22, 2015 in Computer Science - IT by peliant
recategorized Aug 25, 2015 by slow_learner | 73 views

1 Answer

+2 votes
Best answer

Let me tell what parser is first::::

A parser is a compiler or interpreter component that breaks data into smaller elements for easy translation into another language. A parser takes input in the form of a sequence of tokens or program instructions and usually builds a data structure in the form of a parse tree or an abstract syntax tree.

 The overall process of parsing involves three stages:

Lexical Analysis: A lexical analyzer is used to produce tokens from a stream of input string characters, which are broken into small components to form meaningful expressions.
Syntactic Analysis: Checks whether the generated tokens form a meaningful expression. This makes use of a context-free grammar that defines algorithmic procedures for components. These work to form an expression and define the particular order in which tokens must be placed.
Semantic Parsing: The final parsing stage in which the meaning and implications of the validated expression are determined and necessary actions are taken.
A parser's main purpose is to determine if input data may be derived from the start symbol of the grammar. 

 This is achieved as follows:

Top-Down Parsing: Involves searching a parse tree to find the left most derivations of an input stream by using a top-down expansion. Examples include LL parsers and recursive-descent parsers.
Bottom-Up Parsing: Involves rewriting the input back to the start symbol. This type of parsing is also known as shift-reduce parsing. One example is a LR parser.


Parsers are widely used in the following technologies:


Java and other programming languages
HTML and XML
Interactive data language and object definition language
Database languages, such as SQL
 

Examples of  Top-down parsers 
Some of the parsers that use top-down parsing include: 
Recursive descent parser 
LL parser 
Packrat parser 
Unger parser 

Examples of Bottom-up parsers :::
Some of the parsers that use bottom-up parsing include: 
precedence parsing 
BC (bounded context) parsing 
LR parser 
SLR parser 
LALR parser 
Canonical LR parser 
GLR parser 
Earley parser 
CYK parser

 

answered Jun 23, 2015 by nagini s
selected Jun 25, 2015 by peliant
@nagini although answer covers the question you can also include 2 things :
1.Reference links of the sites you have taken content also ,2. add your notes on the topic in a simple manner.because : 1. All answers are available in internet,users will start deriving content and paste as answers,secondly most users dont have a technical background so it would be helpful if tech terms are more simpler..Thanks..keep good work going at enggforum :)