Specifying Syntax

Submitted by: Submitted by

Views: 40

Words: 8329

Pages: 34

Category: Literature

Date Submitted: 02/22/2015 06:13 AM

Report This Essay

1

Chapter 1 SPECIFYING SYNTAX

L

anguage provides a means of communication by sound and written symbols. Human beings learn language as a consequence of their life experiences, but in linguistics—the science of languages—the forms and meanings of languages are subjected to a more rigorous examination. This science can also be applied to the subject of this text, programming languages. In contrast to the natural languages, with which we communicate our thoughts and feelings, programming languages can be viewed as artificial languages defined by men and women initially for the purpose of communicating with computers but, as importantly, for communicating algorithms among people. Many of the methods and much of the terminology of linguistics apply to programming languages. For example, language definitions consist of three components: 1. Syntax refers to the ways symbols may be combined to create well-formed sentences (or programs) in the language. Syntax defines the formal relations between the constituents of a language, thereby providing a structural description of the various expressions that make up legal strings in the language. Syntax deals solely with the form and structure of symbols in a language without any consideration given to their meaning. 2. Semantics reveals the meaning of syntactically valid strings in a language. For natural languages, this means correlating sentences and phrases with the objects, thoughts, and feelings of our experiences. For programming languages, semantics describes the behavior that a computer follows when executing a program in the language. We might disclose this behavior by describing the relationship between the input and output of a program or by a step-by-step explanation of how a program will execute on a real or an abstract machine. 3. Pragmatics alludes to those aspects of language that involve the users of the language, namely psychological and sociological phenomena such as utility, scope of application, and...