Programming Languages Quiz 1

Programming Languages Quiz 1

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

logic

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 14, 2020

Cards (81)

Section 1

(50 cards)

logic

Front

program statements described as facts computer's job is to construct a proof based on the given axion prolog

Back

Backing of a powerful sponsor

Front

COBOL (1959) -> IBM PL/1 (1964) -> IBM Ada (1980) -> Dod C# (2000) -> Microsoft

Back

middle 1980s PM influences

Front

object oriented programming data abstraction/inheritance/polymorphism

Back

language categories

Front

1. imperative 2. functional 3. logic 4. markup/programming hybrid

Back

Why so many PL

Front

languages designed for specific problem domain; personal preference; diverse ideas about best language to use

Back

language evaluation criteria

Front

1. writability: ease w which a language can be used to create programs 2. readability: ease w which programs can be read and understood 3. reliability: programs conform to their specifications under all conditions 4. cost: the ultimate total cost

Back

imperative

Front

central features = variables, assignment statements, and iteration (things that map directly to hardware) languages that support OO programming and scripting languages C, C++, Java, .NET, perl, javascript

Back

FORTRAN I Features

Front

post-test counting loop (do loop) three way selection statement (arithmetic if (expr) neg, pos, zero) user defined subprograms names have up to 6 characters no data typing statements (type dep on first let of variable name)

Back

What makes a language successful

Front

1. ease of use for novice 2. expressive power 3. ease of implementation 4. wide dissemination at minimal cost 5. excellent compilers 6. possibility to compile very good/fast code 7. backing of a powerful sponsor

Back

two main influences on language design

Front

1. computer architecture 2. programming methodologies

Back

computer architecture

Front

Languages are developed around the prevalent computer architecture, known as the von Neumann architecture

Back

imperative language

Front

most dominant because of von neumann computers

Back

FORTRAN 90

Front

free formatting of code, modules, dynamic arrays, array subsection references, case-statement, pointers, recursion, parameter type checking

Back

functional

Front

main means of making computations is by applying functions to given parameters in its purest form defined as mathematical functions, there is no concept of memory, time, or state LISP, Scheme, haskell

Back

FORTRAN evaluation

Front

highly optimized compilers (types/storage of all variables fixed before runtime) dramatically changed forever the way computers are used

Back

ALGOL differences/generalizations from FORTRAN

Front

assignment operator was := subscripts placed in brackets identifier names could be any length arrays could have any number of dimensions

Back

why study PL

Front

1. improve knowledge/understanding of languages you know 2. improve choice of language for applications 3. improve ability to learn new languages 4. choose among alternative ways to express an idea 5. make it easier to design new languages

Back

FORTRAN IV

Front

1960-2, explicit type declarations, logical if statement, subprogram names could be parameters

Back

expressive power languages

Front

APL (1967), Algol-68 (1968), C(1972), common lisp (1984)

Back

language design tradeoffs

Front

1. reliability vs cost of execution 2. writability (flexibility) vs reliability 3. readability vs writability

Back

ALGOL 60 evaluation

Front

Success! All subsequent imperative languages based on it. first machine-independent language. first language whose syntax was formally defined. standard way to publish algorithms for over 20 years failures: never widely used (esp in US), lack of I/O def made programs non-portable, too flexible, lack of support from IBM

Back

excellent compilers; possible to compile very good (fast/small) code

Front

fortran (1957)

Back

reliability

Front

1. type checking - testing for type errors (compile/runtime) - preventing a bit-pattern one type of data from being interpreted as a different type of data 2. exception handling - intercept run-time errors and take corrective measures 3. aliasing - presence of 2+ distinct referencing methods for the same memory location 4. readability and writability -a language that does not support "natural" ways of expressing an algorithm will require "unnatural" approaches

Back

basis for imperative languages

Front

-variables model memory cells -assignment statements model piping -efficient iterative form of repetition

Back

FORTRAN II

Front

1958, independent compilation

Back

non-DSLs

Front

C, C++, COBOL, Fortran not small, VERY expressive, not restricted to specific domains

Back

Other evaluation criteria

Front

1. portability: ease w which programs can be moved from one implementation to the other 2. generality: applicability to a wide range of applications 3. well-definedness: the completeness and precision of the languages official definition

Back

programming methodologies

Front

new software development methodologies (eg object-oriented software development) led to new programming paradigms and by extension, new programming languages

Back

Markup/programming hybrid

Front

Markup languages extended to support some programming Examples: JSTL, XSLT, XML, HTML

Back

ease of use for novice languages

Front

BASIC (1964), Logo (1967), Scheme (1970), Python (1991)

Back

1950s-1960s PM influences

Front

simple applications: worry about machine efficiency

Back

ALGOL design features

Front

concept of data type formalized compound statements (begin...end) if statement has else-if clause parameters separated by mode (passed in/passed out)

Back

ALGOL 60

Front

modified algol 58 at 6 day meeting in paris new features: - subprogram recursion (new for imperative languages) -two parameter passing methods (pass-by-value and pass-by-name) -block structure (lexical scope); nested functions -stack storage allocation

Back

readability

Front

1. simplicity and orthogonality - relatively small set of primitive constants - consistent set of rules for combining them - every possible combination is legal and meaningful -minimal feature multiplicity -minimal operator overloading 2. data types and structures -adequate predefined data types and structures 3. syntax considerations - self-descriptive constructs, meaningful keywords, methods of forming compound statements

Back

ALGOL environment of development

Front

FORTRAN had barely arrived many other languages being dev for spec machines no portable language (all machine dependent) ALGOL = result of efforts to define a universal language

Back

DSLs

Front

cascading style sheets (CSS) structured query language (SQL) unified modeling language (UML) programming can be done by a domain expert (not a seasoned programmer)

Back

FORTRAN outcome

Front

-programs larger than 400 lines rarely compiled -code was very fast -quickly became widely used

Back

ALGOL design process/goals

Front

joint european-american committee met in 1958 goals of language: 1. close to mathematical notation 2. good for describing algorithms 3. must be mechanically translatable to machine code Not intended to be implemented Dropped by IBM-- thought to be too expensive to adopt a new language

Back

ease of implementation; wide dissemination at minimal cost

Front

BASIC (1964), pascal (1970), java (1995)

Back

von neaumann architecture

Front

-memory separate from CPU -data and programs both stored in memory -instructions/data piped from memory to CPU -basis for imperative languages

Back

late 1960s PM influences

Front

people efficiency became important, structured programming: top-down design and step-wise refinement

Back

FORTRAN environment of development

Front

-computers had small memories and were unreliable -applications were scientific -no programming methodologies or tools -machine efficiency was most important concern

Back

writability

Front

1. simplicity and orthogonality - relatively small set of primitive constants - consistent set of rules for combining them - every possible combination is legal and meaningful 2. support for abstraction - ability to define and use complex structures or operations in ways that allow details to be ignored 3. expressivity - a set of relatively convenient ways of specifying operations - strength and number of operators and predefined functions

Back

late 1970s PM influences

Front

process oriented to data oriented; data abstraction

Back

FORTRAN 77

Front

character string handling, logical loop control statement, if-then-else statement

Back

PL/I environment of development

Front

1964: IBM's POV -scientific computing: IBM 1620, 7090 comps, FORTRAN, SHARE user group -business computing: IBM 1401, 7080 comps, COBOL, GUIDE user group by 1963: scientific users need more elaborate I/O business users need FP and arrays

Back

Domain-specific language (DSL) definition

Front

a language specifically designed to perform tasks in a certain domain

Back

implementation methods

Front

1. compilation: programs are translated to machine language (slow transl, fast exe) 2. pure interpretation: programs are interpreted/executed in a stepwise fashion by the interpreter (immediate exe, slower, requires more space) 3. hybrid systems: a compromise between compilers and pure interpreters

Back

cost

Front

more important: -closeness in purpose to application (writing programs) -reliability (poor reliability --> higher cost) -maintaining programs less important: -compiling programs -executing programs (speed, space, etc) -language implementation system (availability/cost of compilers, IDE)

Back

Programming domains w/ corresponding languages

Front

1. scientific apps - large # of FP comps, use of arrays -FORTRAN 2. business apps -produce reports using decimal #s / chars -COBOL 3. AI -manipulate symbols rather than numbers, use of linked lists -LISP 4. systems programming -efficiency, low-level access, pointers -C 5. Web software -Markup (xhtml) -general purpose (java, ruby, kotlin) -scripting (javascript, php)

Back

Section 2

(31 cards)

Java

Front

imperative-based OO language based on C++ (significantly simplified), supports only OOP, has references but not pointers, garbage collector memory management

Back

Pascal

Front

1971: small, simple, nothing new largest impact on teaching programming compilers easy to create, therefore widely used

Back

recognizers

Front

a recognition device reads input strings over the alphabet of the language and decides whether the input strings belong to the language yes/no as to whether string is valid

Back

context-free grammar

Front

language generators, meant to describe the syntax of natural languages

Back

smalltalk

Front

object-oriented programming first full-implementation of an OO language also pioneered graphical user-interface design

Back

PL/I Contributions

Front

-unit-level concurrency -first exception handling -recursion can be turned on/off (for faster exe) -pointers included as data type -first cross section of arrays

Back

derivation

Front

a repeated application of rules, starting with a start symbol (a special nonterminal) and ending with a sentence (a string of only terminal symbols)

Back

generators

Front

a device that generates a valid sentence of a language generates a random sentence each time, thus limited use as language descriptor one can determine if syntax of language is correct by comparing it to structure of generator

Back

language definition

Front

provided by both syntax and semantics

Back

language definition users

Front

-initial evaluators (language designers) -implementers (compiler writers) -programmers (users of language)

Back

syntactic lists

Front

described using recursion: <identifier_list> → identifier | identifier, <identifier_list>

Back

backus-naur form (1959)

Front

invented by john backus to define ALGOL 58 natural notation for describing syntax

Back

stages of compilation

Front

1. lexical analysis: converts characters in source code into lexical units 2. syntax analysis: transforms lexical units into parse tree and check syntactic correctness 3. semantics analysis: type checking/intermediate code generation 4. code generation: machine code is generated

Back

java eval

Front

eliminated unsafe aspects of c++ (pointers); portable (java virtual machines)

Back

nonterminals

Front

abstractions used to represent classes of syntactic structures. often enclosed in angle brackets <logic_expr> <stmt>

Back

ambiguous grammar

Front

grammar is ambiguous if it generates a sentential form that has 2+ parse trees

Back

ALGOL 68

Front

design based on orthogonality source of several new ideas user defined data types (structs) dynamic (flex) arrays

Back

PL/I eval

Front

successes: -used in both business/scientific apps in 1970s -instructional vehicle in college failures: -many new features poorly designed (no reserved keywords) -too large and complex

Back

leftmost vs rightmost derivation

Front

which nonterminal (leftmost or rightmost) to be expanded next

Back

grammar

Front

a meta-language used to define the syntax of a language

Back

4 parts of BNF

Front

1. start symbol 2. finite set of production rules 3. finite set of terminal symbols 4. finite set of nonterminal symbols

Back

c++

Front

developed in 1980, evolved from C and SIMULA 67 large and complex; supports both procedural and OO rapidly grew in popularity along with OOP

Back

terminals

Front

lexemes or tokens: while ( ) if ( ) then

Back

C

Front

1972: designed for systems programming evolved primarily from BCPL, B, but also ALGOL 68 rich set of operators, poor type checking initially spread through unix, many applications

Back

semantics

Front

meaning of the expressions, statements, and program units

Back

production rule

Front

has: a left-hand side (LHS), which is a single nonterminal and... a right-hand side (RHS) which is a string of terminals and/or non terminals

Back

meta-language

Front

A language used to define another language.

Back

lexical analysis

Front

- Source code is used as input - Reserved words are replaced by tokens token = identifier, literal, keyword, operator,etc - Variable names are checked and entered in the symbol table - Constants are entered in the symbol table - Unnecessary characters (white space, comments) are removed / program is formatted ready for the next stage of compilation

Back

solution to 1964 environment

Front

build a new computer to do both business and scientific apps; design a new language to do both apps; "swiss army knife" of PLs

Back

syntax

Front

form or structure of expressions, statements and program units

Back

formal definition of languages (2 ways)

Front

1. recognizers 2. generators

Back