In computer science, it is important to be able to effectively translate high-level languages into language that the computer can understand without a loss of original meaning. A long time ago, programmers had to manually input machine code into the computer, and this was incredibly tedious and very error- prone. After the invention of assembly languages, the process became less labourous, but it was still monotonious. The creation of high-level languages greatly improved the efficiency of coding and made the life of programmers much easier. However, a new problem arose: a computer cannot understand such complex languages. As a result, language translators were born.
Similar to literature, language translators in computer science search for syntax and semantical errors when translating the source code.
Syntax: The grammatical structure of computer language. Analogous to spelling and grammar in literature.
Semantics: The meaning of the computer language constructs. Analogous to context in literature.
For example, the sentence “The bat slipped from Mr. Arkin’s hand” may be grammatically correct(syntax), but its context(semantics) is ambiguous and could have two meanings.
Similarly, the sentence “The cows flowed gloriously” is grammatically correct(syntax), but it does not make sense at all(semantics).