Semantic analysis is the task of ensuring that a program’s declarations and statements are semantically correct, that is, that their meaning is clear and consistent with how control structures and data types should be used.