Compiler - Question and answer - 1

1. What is an interpreter ?
An interpreter is a program that appears to execute a source program as if it were machine language. Languages such as BASIC, SNOBOL, LISP can be translated using interpreters. JAVA also uses interpreter. The process of interpretation can be carried out in following phases.
a. Lexical analysis
b. Synatx analysis
c. Semantic analysis
d. Direct Execution

2. What are Lexical errors ?
Lexical errors are the errors thrown by your lexer when unable to continue. Which means that there's no way to recognise a lexeme as a valid token for you lexer. Syntax errors, on the other side, will be thrown by your scanner when a given set of already recognised valid tokens don't match any of the right sides of your grammar rules. simple panic-mode error handling system requires that we return to a high-level parsing function when a parsing or lexical error is detected.

3. What is dynamic scoping?
Dynamic scoping is a programming language paradigm that you don’t typically see. The scoping that most programmers are used to is called lexical scoping. It’s found in Lua and many other languages. Lexical scoping is the dominant choice for a reason: it’s easy to reason about and understand just by looking at the code.

4. What are the important role of translator ?
a. Translating the HLL program input into an equivalent ml program.
b. Providing diagnostic messages wherever the programmer violates specification of the HLL.

5. What is Syntax-directed Translation Schemes(SDTS) ?
A translation scheme is a context-free grammar in which program fragments called translation actions are embedded within the right sides of the production.
SDTS generates an output for each sentence x generated by underlying grammar by executing actions in the order they appear during depth-first traversal of a parse tree for x.
1 2 3 4 5 6 7 8