Professional Documents
Culture Documents
Introduction
In the last study session , you have been introduced to the various approaches to problem
solving, Algorithm, Pseudocode and Flowchart, the various ways of representing an algorithm
and also its properties, differences between Pseudocode and Flowchart, the symbols used in
designing Flowcharts and the advantages and disadvantages of using a Flowchart.
In this study session, you will be introduced to syntax, semantics and pragmatics of selected
programming language. The importance of syntax and its properties will be discussed while the
theories and levels of semantics will also be discussed.
In pragmatics, it deals with the some idea of the strengths and weaknesses of languages rules so
as to understand the levels of the language of your program. In semantics, this is what your
programming languages are all about, and where the real advances are made when dealing with
you programming.
4.1.1 Syntax
The syntax of a Programming language determines which character strings constitute well-
formed programs in the language and which do not so as to know how the syntactic of your
program is well defined.
Programming language's surface form is known as its syntax. Most programming languages are
purely textual; they use sequences of text including words, numbers, and punctuation, much like
written natural languages. On the other hand, there are some programming languages which are
more graphical in nature, using visual relationships between symbols to specify a program.
The syntax of a language describes the possible combinations of symbols that form a
syntactically correct program and the meaning given to a combination of symbols is handled by
semantics (either formal or hard-coded in a reference implementation). Since most languages are
textual, this article study session introduced you to a textual syntax.
The syntax of a Programming language determines which character strings constitute well-
formed programs in the language and which do not so as to know how the syntactic of your
program is well defined.
Example 4.1:
1. Expression:= atom | list
2. Atom: = number | symbol
3. Number: = [+-]? ['0'-'9']+
4. Symbol: = ['A'-'Z''a'-'z'].*
5. List: = '(' expression* ')'
Syntax simply describes the possible combinations of symbols that form a syntactically correct
program; Semantics describes the meaning of a language while pragmatics relates the concepts
of language.
Example 4.2
In FORTRAN, variables don’t have to be declared therefore, every misspelling is a new variable
Example 4.4
In Ada, control statements have the form if…end if, while…end while, case…end case, etc. This
helps avoid the confusion (in C) resulting from large groups of anonymous closing braces
Therefore, Syntax is usually more important for reading and understanding programs than for
writing them.
The second level of properties consists of the rules that governing representation and
interpretation of constants.
That is rules about the specification of exponents in floating point numbers or the allowed
forms of integers (decimal, hexadecimal, etc.).
Semantics focuses on the relation between signifiers, like words, phrases, signs, and symbols,
and what they stand for, which is their denotation. Linguistic semantics is the study of meaning
that is used for understanding human expression through language. Other forms of semantics
include the semantics of programming languages, formal logics, and semiotics.
The term Semantics refers to the meaning of languages which has to do with the meaning of
constructs in a language and the meaning of programs written in that
While Formal (or truth-conditional) semantics : is a semantics that aims aims to associate you
with each natural language sentence with a meta-language description of the conditions under
which it is true, for example when the Snow is white' is true if and only if snow is white. The box
below will expose you to some challenges you likely to see in semantics manner.
High level Semantics: in high level semantics, semantics can affect things at a very high level.
Example 4.4
Low level Semantics: This is a semantics that can affect things at a very low level. The box
below shows the examples that relate with the meaning of a low level semantics.
4.3. Pragmatics
Pragmatics is a subfield of linguistics and semiotics which studies the ways in which context
contributes to meaning. Pragmatics encompasses speech act theory, conversational, talk in
interaction and other approaches to language behaviour in philosophy, sociology, linguistics and
anthropology. Unlike semantics, which examines meaning that is conventional or “coded” in a
given language?
Pragmatics is a subfield of linguistics and semiotics which studies the ways in which context
contributes to meaning.
a. Pragmatics has to do with how well the language connects to the “real world”
b. Semantics supports pragmatics: some kinds of languages are better for some kinds of
problems
c. The choice of a language should depend on pragmatic considerations
Pilot Question 4.3
1. What do you understand by the word “Pragmatics”
2. Enumerate the importance of Pragmatics.
1. The syntax of a Programming language determines which character strings constitute well-
formed programs in the language and which do not so as to know how the syntactic of your
program is well defined
2. The three importance of syntax which are: very easy to write program, easy to write and
understand and easy to make hard in syntax error.
3. Three importance of Syntax which are: the first level is syntactic rules of a language, the
second level properties consist of rules that governing representation of constants and the
third level of syntactic is termed as the concrete syntax.
4. The term semantics refers to the meaning of languages, which has to do with the meaning of
constructs in a language, and the meanings of programs written in that language is known as
Semantics.
5. In Semantics, we have different theories which are: Models theoretical and formal (or truth)
semantics.
6. The two levels of Semantics which are High level and low level semantics.
7. Pragmatics is a subfield of linguistics and semiotics which studies the ways in which context
contributes to meaning