Electrical and Computer Engineering
21 of 30
UAH
CPE 112
Syntax and Semantics
•Syntax consists of the formal rules governing how valid instructions are written in a programming language. (grammar)
•Semantics consists of the set of rules that determines the meaning of instructions written in a programming language. (meaning)
•A metalanguage is a language that is used to write the syntax rules for another language.
•In this book, we write the syntax rules for C++ using a metalanguage called a syntax template.