answersLogoWhite

0


Best Answer

· In the compiler model, the parser obtains a string of tokens from the lexical analyser, and verifies that the string can be generated by the grammar for the source language.

· The parser returns any syntax error for the source language.

· There are three general types' parsers for grammars.

· Universal parsing methods such as the Cocke-Younger-Kasami algorithm andEarley's algorithm can parse any grammar. These methods are too inefficient to use in production compilers.

· The methods commonly used in compilers are classified as either top-down parsing or bottom-up parsing.

· Top-down parsers build parse trees from the top (root) to the bottom (leaves).

· Bottom-up parsers build parse trees from the leaves and work up to the root.

· In both case input to the parser is scanned from left to right, one symbol at a time.

· The output of the parser is some representation of the parse tree for the stream of tokens.

· There are number of tasks that might be conducted during parsing. Such as;

o Collecting information about various tokens into the symbol table.

o Performing type checking and other kinds of semantic analysis.

o Generating intermediate code.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the role of a parser in compiler design?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the difference between a compiler design and a compiler?

In Compiler there is no design word ,whereas in compiler design there is design word


How to design a Compiler?

This is a fairly complex answer, but it basically boils down to a few oversimplified steps. First, design a language, or find the specifications for a language you would like to use. Second, design a lexical parser that can interpret the "tokens" that you designed in your language. Third, design a compiler/linker that will assemble the tokens into binary code, and link them with the appropriate libraries. Your exact steps will vary depending on the operating system you are using, the compiler you have available, etc.


When was Principles of Compiler Design created?

Principles of Compiler Design was created in 1977.


What is the difference between interpreter and parser and compiler?

in my personal point of view i would say a parser is more like "one-directional" "automatic" vs. an interpreter, the interpreter has more "intelligence"


What is the role of data structure in compiler design?

The role of the data structure in compiler designer is to take an input of a program written in another language and produce an output in another language. It also performs error detection.


The role of automata theory in compiler construction?

Lexical analysis is the first state of the Compiler design, in this state human typed programs are broken in to tokens and then those tokens are recognized through the Automata theory. For more details please refer the book, Modern Compiler designing in C


Which is the best book for compiler design?

Ulman


What is the role of parser in compiler design?

· In the compiler model, the parser obtains a string of tokens from the lexical analyser, and verifies that the string can be generated by the grammar for the source language.· The parser returns any syntax error for the source language.· There are three general types' parsers for grammars.· Universal parsing methods such as the Cocke-Younger-Kasami algorithm andEarley's algorithm can parse any grammar. These methods are too inefficient to use in production compilers.· The methods commonly used in compilers are classified as either top-down parsing or bottom-up parsing.· Top-down parsers build parse trees from the top (root) to the bottom (leaves).· Bottom-up parsers build parse trees from the leaves and work up to the root.· In both case input to the parser is scanned from left to right, one symbol at a time.· The output of the parser is some representation of the parse tree for the stream of tokens.· There are number of tasks that might be conducted during parsing. Such as;o Collecting information about various tokens into the symbol table.o Performing type checking and other kinds of semantic analysis.o Generating intermediate code.


What is booting in compiler design?

bootstrapping is a process of writing a compiler in the target programing language which it is intended to compile


Where can you find an assembly program compiler and editor for the TI 84 calculator?

There is a TI asm manual with links on ticalc.org. But before you try that, Google "Axe Parser". Its not as good as it looks-- its better!


What is role of compiler?

It coverts your source code into machine code so the computer can execute it.


Who was the first design the compiler?

No one knows and no one cares.