1) Problems:
i) Lexical ambiguity: It is at very primitive level such as word level.
ii) Syntax-Level Ambiguity: A sentence can be parsed in to many different ways.
iii) Referential ambiguity: Refers to something using pronouns.
iv) An input can have different meaning.
v) Many inputs can have same meaning.
2) Compiler Construction Techniques:
i) Parser Generator: It produces syntax parsers from the input
that is based on a grammatical description of programming language
or on a context-free grammar. It is useful as the syntax analysis
phase is highly complex and consumes more manual and compilation
time.
Example: EQM, PIC
ii) Scanner Generator: It generates lexical
analyzers from the input that consists of regular expression
description based on tokens of a language. It generates a finite
automaton to recognize the regular expression.
Example: Lex
iii) Syntax directed translation engines: It generates intermediate code with the three address format from the i/p that consists of a parse tree. These engines have routines to traverse the parse tree and then produces the intermediate code. In this, each node of the parse tree is associated with one or more translations.
iv) Automatic code generators: It generates the machine language for a target machine. Each operation of the intermediate language is translated using a collection of rules and then is taken as an input by the code generator. A template matching process is used.
v) Data flow analysis engines: It is used in code optimization. Data flow analysis is a key part of the code optimization which gathers the information, that is the values that flow from one place of a program to another part.
vi) Compiler construction toolkits: Provides an integrated set of routines that aids in building compiler components or in the construction of various phases of compiler.
3) Solving Problems using compiler techniques:
Get Answers For Free
Most questions answered within 1 hours.