File

advertisement
3
Describing Syntax and Semantics
4
Lexical and Syntax Analysis
Interpersonal &
Responsibility
skills
Preliminaries
Communication
and I.T. Skills
1,2
Before we begin discussing the concepts of
programming languages, we must consider a few
preliminaries. First, we explain some reasons why
computer science students and professional software
developers should study general
concepts of language design and evaluation. This
discussion is especially valuable for those who believe
that a working knowledge of one or two programming
languages is sufficient for computer scientists. Then, we
briefly describe the major
programming domains. Next, we present a list of
criteria that can serve as a basis for such judgments.
Then, we discuss the two major influences on language
design: machine architecture and program design
methodologies. After that, we introduce the various
categories of programming languages. Next, we
describe a few of the major trade-offs that must be
considered during language design.
this week includes an overview of the most common
general approaches to implementation.
Finally, we briefly describe a few examples of
programming environments and discuss their impact on
software production.
his week covers the following topics. First, the terms
syntax and semantics are defined. Then, a detailed
discussion of the most common method of
describing syntax, context-free grammars (also known
as Backus-Naur Form), is presented. Included in this
discussion are derivations, parse trees, ambiguity,
descriptions of operator precedence and associativity,
and extended Backus-Naur Form. Attribute grammars,
which can be used to describe both the syntax and static
semantics of programming languages, are discussed
next. In the last section, three
formal methods of describing semantics— operational,
axiomatic, and denotational semantics—are introduced.
Because of the inherent complexity of the semantics
description methods, our discussion of them is brief.
This chapter begins with an introduction to lexical
analysis, along with a simple example. Next, the
general parsing problem is discussed, including the two
primary approaches to parsing and the complexity of
parsing. Then, we introduce the recursivedescent
implementation technique for top-down parsers,
including examples of parts of
a recursive-descent parser and a trace of a parse using
one. The last section discusses bottom-up parsing and
the LR parsing algorithm. This section includes an
example of a small LR parsing table and the parse of a
string using the LR parsing process.
ILO’S in percentage (%)
Cognitive &
Numerical Skills
Description
Week #
Topic
‫جامعة سلمان بن عبد العزيز‬
‫كلية اآلداب والعلـوم بوادي الدواسر‬
‫قســـم علوم الحاسب و المعلومات‬
Knowledge
Course Description based on ILO’s
1435/1434 ‫للفصل الدراسي الثاني للعام الجامعي‬
Concepts of Programming Languages _337CS :‫المقرر‬
147
:‫شعبة‬
5 :‫المستوى‬
50
25
0
25
50
25
0
25
50
25
0
25
Course Description based on ILO’s
1435/1434 ‫للفصل الدراسي الثاني للعام الجامعي‬
Concepts of Programming Languages _337CS :‫المقرر‬
147
:‫شعبة‬
5 :‫المستوى‬
‫جامعة سلمان بن عبد العزيز‬
‫كلية اآلداب والعلـوم بوادي الدواسر‬
‫قســـم علوم الحاسب و المعلومات‬
This chapter introduces the fundamental semantic
issues of variables. It begins by describing the nature of
names and special words in rogramming
languages. The attributes of variables, including type,
address, and value, are then discussed, including the
issue of aliases. The important concepts of binding and
binding times are introduced next, including the
different possible
binding times for variable attributes and how they
define four different categories of variables. Following
that, two very different scoping rules for names, static
and dynamic, are described, along with the concept of a
referencing environment of a
statement. Finally, named constants and variable
5
Names, Bindings, and Scopes initialization are discussed.
6
Data Types
7
Statement-Level Control
Structures
8,9
Subprograms
10
Abstract Data Types and
Encapsulation Constructs
11
Support for Object-Oriented
Programming
This chapter first introduces the concept of a data type
and the characteristics of the common primitive data
types. Then, the designs of enumeration and subrange
types are discussed. Next, the details of structured data
types specifically arrays, associative arrays, records,
tuples, lists, and unions—are investigated.This section
is followed by an in-depth look at pointers and
references.
For each of the various categories of data types, the
design issues are statedand the design choices made by
the designers of some common languages are described.
These designs are then evaluated.
The next three sections provide a thorough investigation
of type checking, strong typing, and type equivalence
rules. The last section of the chapter briefly introduces
the basics of the theory of data types.
The flow of control, or execution sequence, in a
program can be examined at several levels.
At the highest level is the flow of control among
program units
the important issue of the flow of control among
statements, which is the subject of this chapter.
Subprograms are the fundamental building blocks of
programs and are therefore among the most important
concepts in programming language design. We now
explore the design of subprograms, including
parameter-passing methods, local referencing
environments, overloaded subprograms, generic
subprograms,
and the aliasing and problematic side effects that are
associated with subprograms.
We also include discussions of indirectly called
50
25
0
25
50
25
0
25
50
25
0
25
50
25
0
25
50
25
0
25
50
25
0
25
subprograms, closures, and coroutines.
in this chapter, we explore programming language
constructs that support data abstraction. Among the new
ideas of the last 50 years in programming
methodologies and programming language design, data
abstraction is one of the most profound.
This chapter begins with a brief introduction to objectoriented programming,followed by an extended
discussion of the primary design issues for inheritance
and dynamic binding. Next, the support for objectoriented programming in Smalltalk, C++, Objective-C,
Course Description based on ILO’s
1435/1434 ‫للفصل الدراسي الثاني للعام الجامعي‬
Concepts of Programming Languages _337CS :‫المقرر‬
147
:‫شعبة‬
5 :‫المستوى‬
12
Exception Handling and Event
Handling
14
Functional Programming
Languages
15
Logic Programming Languages
Course Instructor
Dr. Abdalla Al-Ameen
Signature……………………
‫جامعة سلمان بن عبد العزيز‬
‫كلية اآلداب والعلـوم بوادي الدواسر‬
‫قســـم علوم الحاسب و المعلومات‬
Java, C#, Ada 95, and Ruby is discussed. The chapter
concludes with a short overview of the implementation
of dynamic bindings of method calls to methods in
object-oriented languages.
T his chapter discusses programming language support
for two related parts of many contemporary programs:
exception handling and event handling. Both exceptions
and events can occur at times that cannot be
predetermined,
and both are best handled with special language
constructs and processes. Some of these constructs and
processes for example,propagation—are similar for
exception handling and event handling.
This chapter introduces functional programming and
some of the programming languages that have been
designed for this approach to software development.
The objectives of this chapter are to introduce the
concepts of logic programming and logic programming
languages, including a brief description of a subset of
Prolog.
50
25
0
25
50
25
0
25
50
25
0
25
The Supervisor of Department
Dr. Saied M. Abd El-atty
Signature………………
Download