Semantic AnalysisWu Hang
Wu Hang
OutlineIntroductionRequirementsCheckingEnvironmentHow to startTips
Introduction Requirements Checking Environment How to start Tips
IntroductionPurposeo Is syntactic analysis sufficient for program checking?。What's the differences between syntax andsemantics?Approach After syntactic analysisWhat is a program?
Purpose ◦ Is syntactic analysis sufficient for program checking? ◦ What’s the differences between syntax and semantics? Approach ◦ After syntactic analysis What is a program?
Requirements/Seewikio Refer to gcc for anysemanticissues notmentioned.。 Discuss when you find sth. strange.。Maytest many cases。Take everything into consideration
See wiki ◦ Refer to gcc for any semantic issues not mentioned. ◦ Discuss when you find sth. strange. ◦ May test many cases ◦ Take everything into consideration
CheckingType checkingUse before declarationDuplicate variablesSubscript checking Pointer checking (return value, parameters,assignment, etc.)Mismatch parameters of function or fields ofrecordBreak/continue out of a loop Struct checking (return value, parameters,assignment, etc.)Etc
Type checking Use before declaration Duplicate variables Subscript checking Pointer checking (return value, parameters, assignment, etc.) Mismatch parameters of function or fields of record Break/continue out of a loop Struct checking (return value, parameters, assignment, etc.) Etc