module 1 Flashcards
(76 cards)
what are the categories of language evaluation criteria?
- readability
- writability
- reliability
- cost
what are languages developed around?
Von Neumann architecture
draw and describe the von neumann architecture
§ Data and programs stored in memory
§ Memory is separate from CPU
§ Instructions and data are piped from memory to CPU
§ Basis for imperative languages
why do we need different languages?
New software development methodologies (e.g., object-oriented software development) led to new programming paradigms and by extension, new
programming languages
what are the 4 language categories?
- imperative: variables, assignment statements, iteration, scripting, visual, and object-oriented languages (Java, C, JavaScript)
- functional: main means of making computations is by applying functions to given parameters
- logic: rule-based (prolog)
- markup/programming hybrid: markup languages extended to support some programming (JSTL)
what are the tradeoffs in language design?
reliability vs cost of execution (java demands all references to array elements to be checked for proper indexing)
readability vs writability (APL allows complex computations by containing powerful operators)
writability vs reliability (C++ pointers are powerful and flexible but unreliable)
3 implementation methods
- compilation: programs are translated into machine language (large commercial applications)
- pure interpretation: programs are interpreted by another program known as an interpreter (small programs, efficiency is not concern)
- hybrid implementation systems: compromise between compilers and pure interpreters (small and medium systems)
what are the phases of the compilation process?
- lexical analysis: converts characters in the source program into lexical units
- syntax analysis: transforms lexical units into parse trees
- semantics analysis: generate intermediate code
- code generation: machine code is generated
linking and loading
process of collecting system program units and linking them to a user program
von neumann bottleneck
- connection speed between a computer’s memory and its processor determines the speed of a computer
- program instructions can be executed faster than the speed of the connection
- Memory and the CPU are separated in the Von Neumann architecture, so the CPU must fetch data for every operation it performs
- limiting factor in the speed of computers
pure interpretation
- no translation
- easier implementation of programs
- slower execution
- often requires more space
hybrid implementation systems
- high-level language program is translated to an intermediate language and allows easy interpretation
- faster than pure interpretation
just in time implementation systems
- initially translate programs to an intermediate language
- compile the intermediate language of the subprograms into machine code when they are called
what do preprocessors do?
processes a program immediately before the program is compiled to expand embedded preprocessor macros (used to specify that code from another file is to be included)
syntax
form or structure of the expressions, statements, and program units
semantics
the meaning of the expressions, statements, and program units
sentence
string of characters over some alphabet
language
set of sentences
lexeme
lowest level syntactic unit of a language
token
category of lexemes
recognizer
reads input strings over the alphabet of the language and decides whether the input strings belong to the language
generator
device that generates sentences of a language
context-free grammar
Language generators, meant to describe the syntax of natural languages
backus-naur form
BNF is equivalent to context-free grammars
Invented by John Backus to describe the syntax of Algol 58