Professional Documents
Culture Documents
Preliminaries
Preliminaries
WMSU
Outline
1.1 Reasons for Studying Concepts of Programming Languages
1.2 Programming Domains
1.3 Language Evaluation Criteria
1.4 Influences on Language Design
1.5 Language Categories
1.6 Implementation Methods
1.7 Programming Environment (IDE)
Reasons for Studying Concepts of Programming Languages
int main() {
TestClass tc;
--tc;
tc.Display();
return 0;
}
1. Readability
b. Orthogonality - "Changing A does not change B”
Ex: A+B
c. Data Types – significant aid for readability
timeOut = 1
timeOut = true
d. Syntax Design
Ex: In Ada, it uses end if to end selection construct
and end loop to terminate loop construct
Language Evaluation Criteria
2. Writability – measure of how easily a language can be used
to create programs for a chosen problem domain
a. Simplicity and Orthogonality – too many programming constructs
may lead to misuse of some features and disuse of others that can be
more elegant and sufficient.
b. Expressivity
Language Evaluation Criteria
3. Reliability – a program is reliable if it performs to its
specifications under all conditions.
4. Cost
– Cost of training programmers to use the language
– Cost of writing programs in the language
– Cost of compiling programs in the language
– Cost of executing programs written in a language
– Cost of language implementation system
– Cost of poor reliability
– Cost of maintaining programs
Language Evaluation Criteria
5. Other Criteria
A. Portability – the ease with which programs can be moved from one
implementation to another.
B. Generality – applicability to a wide range of applications.
C. Well-definedness – the completeness and precision of the
language’s official defining document.
Influences on Language Design
Computer Architecture
• von Neumann architecture by John von Neumann
• Data and programs stored in memory
• Memory is separate from CPU
• Instructions and data are piped from
memory to CPU
• Basis for imperative languages
von Neumann Architecture
Language Categories
• Imperative
– Central features are variables, assignment statements, and iteration
– Include languages that support object-oriented programming
– Include scripting languages
– Include the visual languages
• Examples: C, Java, Perl, JavaScript, Visual BASIC .NET, C++
• Functional
– Main means of making computations is by applying functions to
given parameters
• Examples: LISP, Scheme
Language Categories
• Logic
– Rule-based (rules are specified in no particular order)
– Example: Prolog
• Markup/programming hybrid
– Markup languages extended to support some programming
– Examples: JSTL (Java Standard Tag Library), XSLT (Extensible
Stylesheet Language Transformations)
Implementation Methods
1. Compilation Implementation – when programs are being
translated into machine language
Lexical Analyzer
• Gathers characters of the source program into
lexical units.
• Lexical units:
– Identifiers
– Special words
– Operators
– Punctuation marks
Syntax Analyzer
• takes the lexical units from the lexical analyzer
• uses them to construct hierarchical structures
called parse trees.
Semantic Analyzer
• semantic analyzer checks for errors, such as
type errors, that are difficult, if not impossible,
to detect during syntax analysis.
Symbol Table
• a database for the compilation process.
• The primary contents of the symbol table are
the type and attribute information
Optimization
• which improves programs by making them
smaller or faster or both.
Code Generator
• translates the optimized intermediate code
version of the program into an equivalent
machine language program.
Implementation Methods
2. Pure Implementation
– easy implementation of many source-level
debugging operations
– 10 to 100 times slower that in compiled
systems
– Rare for high-level languages
– Significant comeback with some Web
Scripting languages (i.e., JavaScript, PHP)
Implementation Methods
3. Hybrid Implementation Systems
– A high-level language program is
translated to an intermediate language
that allows easy interpretation
– Faster than pure interpretation
• Examples
– Perl programs are partially compiled to
detect errors before interpretation
– Initial implementations of Java were
hybrid
Implementation Methods
4. Preprocessor
– processes a program immediately before the program is compiled to
expand embedded preprocessor macros
Programming Environments (IDE)
• The collection of tools used in the development of software.
• This collection may consist of only a file system, a text editor, a
linker, and a compiler.
• Or it may include a large collection of integrated tools, each
accessed through a uniform user interface.
Examples:
1. UNIX
• an older programming environment, first distributed in the middle
1970s, built around a portable multiprogramming operating system.
• Nowadays often used through a GUI (e.g., CDE, KDE, or GNOME)
that runs on top of UNIX
Examples:
2. Borland JBuilder
• programming environment
that provides an integrated
compiler, editor, debugger,
and file system for Java
development, where all four
are accessed through a
graphical interface.
Examples:
3. Microsoft Visual Studio .NET
• is Microsoft's visual programming environment. The product suite provides a
visual interface for identifying a program as a Web service, forms for building a
user interface (including support for mobile device interfaces), features for
integrating existing application data, and for debugging. Visual Studio .NET comes
with the .NET Framework, including the Common Language Runtime, and includes
several programming languages including Visual Basic, Visual C++, and Visual C#.
Examples:
4. NetBeans
• development
environment that is
primarily used for
Java application
development but
also supports
JavaScript, Ruby, and
PHP
End of Presentation