An interpreter is a computer program that directly executes source code or translates source code into an intermediate representation to immediately execute. A parser is a program that breaks input like source code instructions or markup tags into parts like nouns, verbs, and attributes, and checks that all necessary input is provided. Parsers are often part of interpreters or compilers and check syntax to build a parse tree from tokens created by a lexical analyzer.
1 of 5
Download to read offline
More Related Content
Diif bw parser and interpreter
2. Interpreter: interpreter normally means a computer
program that executes
An interpreter may be a program that either
1. executes the source code directly
2. translates source code into some efficient
intermediate representation (code) and immediately
executes this
3. explicitly executes stored precompiled code[1] made
by a compiler which is part of the interpreter system
OR it interprets the machine while executing
3. Parser: Parser is a computer program usually a part of
compiler that receives input form of sequential source
program instructions, interactive online commands,
markup tags, or some other defined interface and
breaks them up into parts (for example, the nouns
(objects), verbs (methods), and their attributes or
options) that can then be managed by other
programming (for example, other components in a
compiler). A parser may also check to see that all input
has been provided that is necessary.
4. A parser is one of the components in an interpreter or
compiler, which checks for correct syntax and builds a
data structure (often some kind of parse tree, abstract
syntax tree or other hierarchical structure) implicit in
the input tokens. The parser often uses a separate
lexical analyser to create tokens from the sequence of
input characters. Parsers may be programmed by hand
or may be semi-automatically generated (in some
programming language) by a tool (such as Yacc) from a
grammar written in Backus-Naur form.