Syntax vs. Semantic
• Algorithms + Data Structures = Program
• Syntax : Grammar BNF :> Syntax Error, Compile-Time Error
(Compiler, Interpreter)
• Semantic : Meaning :> Semantic Error, Run-Time Error, Execution
Time Error (bug)
Type Checking
• A type system is a set of types and type constructors (integers, arrays,
classes, etc.) along with the rules that govern whether or not a
program is legal with respect to types (i.e., type checking).
int x = (int) “Hello”; [Yes] C++ [No] Java
• Type checking checks and enforces the rules of the type system to
prevent type errors from happening.
VAR s:String;
s := 1234;
Strongly-typed language
• Strong type checking prevents all type errors from happening. The
checking may happen at compile time or at run time or partly at
compile time and partly at run time.
• A strongly-typed language is one that uses strong type checking.