Discussion
A compiler for a language with no type declarations must
Answer: B
Correct answer: infer the types of expressions from their use in the program
Absence of declarations does not mean absence of types. The compiler deduces them from how values are used - from literals, from the operators applied, and from the requirements of the functions a value is passed to.
Hindley-Milner inference is the classical algorithm, and ML and Haskell rest on it. Semantic analysis is certainly not abandoned; if anything it does more work, since it must reconstruct what a declaring language would simply have been told.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development