Test 1 Flashcards
List the five programming domains and give an example language for each
Scientific applications -Fortran Business applications -COBOL Artificial intelligence -L1SP Systems programming Web Software -Java
List the four major language evaluation criteria.
- Readability
- Writability
- Reliability
- Cost
the ease with which programs can be read and understood
Readability :l
the ease with which a language can be used to create programs
Writability
conformance to specifications (i.e., performs to its specifications)
Reliability
the ultimate total cost
Cost
List the four programming language categories
Imperative
Functional
Logic
Markup/programming hybrid
Programming domain : Large numbers of floating point computations use of arrays
Scientific applications
Programming domain : Produce reports, use decimal numbers and characters
Buisness applications
Programming domain : Symbols rather than numbers manipulateduse of linked lists
Artificial intelligence
Programming domain : Need efficiency because of continuous use
Systems programming
Programming domain : Eclectic collection of languages markup (e.g., HTML ), scripting (e.g., PHP), general-purpose (e.g., Java)
Web software
- 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++
Imperative
- Main means of making computations is by applying functions to given parameters
- Examples LISP, Scheme, ML , F#
Functional
- Rule-based (rules are specified in no particular order )
- Example: Prolog
Logic
- languages extended to support some programming
- Examples: JSTL, XSLT
Markup/programming hybrid
the form or structure of the expressions , statements , and program units
Syntax
the meaning of the expressions, statements, and program units
Semantics
is a language that is used to describe another language .
metalanguage
abstractions are used to represent classes of syntactic structures–they act like syntactic variables (also called nonterminal symbols, or just terminals )
BNF
A grammar that generates a sentential form for which there are two or more parse trees can be said to be
Ambiguous grammars
An unambiguous grammar will indicate the precedence levels of the operators
Precedence is introduced by adding new non terminal symbols .
Symbols with lowest precedence are cascaded closest to the start symbol .
Because of minor inconveniences in BNF , there are a number of extended versions (________) . The extended versions do not enhance the descriptive power of BNF , they only increase its readability and writability .
EBNF
Describing the Meanings of Programs: Dynamic Semantics
Operational Semantics
Denotational
Semantics Axiomatic Semantics
- Programmers need to know what statements mean
- Compiler writers must know exactly what language constructs do.
- Correctness proofs would be possible
- Compiler generators would be possible
- Designers could detect ambiguities and inconsistencies
Semantics
Describe the meaning of a program by executing its statements on a machine , either simulated or actual . The change in the state of the machine ( memory , registers , etc.) defines the meaning of the statement
Operational semantics
How can we specify tokens?
Formal Description State Diagram (aka finite automata)
- Recursive cent - a coded implementation
- LL parsers table driven implementation
Top-Down parsing
- Left recursion
- Pairwise disjointness
Top-Down parsing problems
A manageable set of features and constructs Minimal feature multiplicity. Minimal operator overloading
Simplicity
means that operations change just one thing without affecting others. The regarding sets as instruction set
orthogonality
the existence of multiple ways of doing the same operation
feature multiplicity
A set of relatively convenient ways of specifying operations. Strength and number of operators and predefined functions
Expressivity
Testing for type errors
Type checking
Intercept run-time errors and take corrective measures
Exception handling
Presence of two or more distinct referencing methods for the same memory location
Aliasing
This means C++ has the ability to provide the operators with a special meaning for a data type. For example, we can use a ‘+’ in a class String so that we can concatenate two strings by just using +
Operator overloading
is based on the stored-program computer concept where instruction data and program data are stored in the same memory.
Von Neumann architecture
object-oriented software development, led to new programming paradigms and by extension, new programming languages
Methodologies
Program can be translated into machine language, which can be executed directly on computer. This method is called
Programs are interpreted by another program called an interpreter , with no translation . This method is called
implementation systems are compromise between compilers and pure interpreters, called
Compiler
Interpreter
Hybrid
Reasons for studying concepts of programming languages:
Increased ability to express ideas
Improved background for choosing appropriate languages
Increased ability to learn new languages
Better understanding of significance of implementation
Better use of languages that are already known
John backus in 1957. Numerical programming language.
John mcCarthy in 1958. Dwrives from list processor
US department of defense in late 1950s. Stands fot common buisness oriented language
John george kemeny and tom kurtzas as a teaching tool for undergraduates
Niklaus wirth in 1970. Names in honor of a french mathematician, philosopher and physicist.
Fortran Lisp Cobol Basic Pascal
Developed at Bell Labs by Dennis Ritchie between 1972 and 1973
Bjarne Stroustrup at Bell Labs in 1979
Originated during online chat. Yukihiro “Matz” mid- 1990s in Japan
Suns microsystems. James gosling led a team if researchers in 1991
1989s by Guido van Rossuk at CWI in the netherlands
C C++ Ruby Java Python
device reads input strings over the alphabet of the language and decides whether the input strings belong to the language
Recognizers
A device that generates sentences of a language. One can determine if the syntax of a particular sentence is syntactically correct by comparing it to the structure to itself
Generators
are a formal approach to both describing and checking the correctness of static semantic rules of a program .
Attribute grammars
Describe the meaning of a program by executing its statements on a machine , either simulated or actual. The change in the state of the machine ( memory , registers , etc.) defines the meaning of the statement
Operational semantics
programming language is constructed by giving a domain of interpretation to each of the program -phrase categories together with semantic functions that compositionally describe the meaning of the phrase-forming constructs
denotational semantics
is an approach based on mathematical logic for proving the correctness of computer programs.
Axiomatic semantics
Identifies substrings of the source program that belong together
lexemes
Lexemes match a character pattern , which is associated with a lexical category called a
token
Given a sentential form, xAa, the parser must choose the correct A-rule to get the next sentential form in the leftmost derivation, using only the first token produced by A
Top-down Parsing
Given a right sentential form, a, determine what substring of a is the right-hand side of the rule in the grammar that must be reduced to produce the previous sentential form in the right derivation
Bottom-up parsing
is so named because it consists of a collection of subprograms , many of which are recursive, and it produces a parse tree in top- down order.
recursive-descent parser