click below
click below
Normal Size Small Size show me how
PL Quiz 1
Question | Answer |
---|---|
Reasons for so many programming languages | Evolution. Languages designed for a specific domain. Different ideas on what should be used. |
What makes a language successful | Ease of use, expressive power, ease of implementation, excellent compilers, and a powerful sponsor. |
Domain specific language | A language designed for a specific domain. Can be performed by domain expert, not necessarily a seasoned programmer. |
Domain specific language examples | CSS, Excel formulas, LaTeX, SQL |
General Purpose language | A language that is applicable across application domains |
General Purpose language examples | C, C++, Java, Python. (COBOL and Fortran started as business and science languages). |
Language evaluation criteria | writability, readability, reliability, cost |
Writability | Simplicity and orthogonality: small set of primitive constructs, consistent rules, legal and meaningful combinations. Expressivity: convenient ways to specify operations, and predefined functions |
Readability | Simplicity: minimal feature multiplicity and minimal operator overloading. Data types and structures: adequate predefined data types and structures. Syntax: self-descriptive constructs, meaningful keywords |
Reliability | type checking, exception handling, readability and writability, and aliasing (nothing to same memory location). |
Cost | Cost to write, reliability costs, maintainment costs. |
Other evaluation criteria | Portability: how easy is it to move one implementation to another (JVM). Generality: applicability to a wide range of applications. Well-definedness: completes and precision of language's official definition. |
First influence on language design | von Neuman architecture. Memory separate from CPU, data and programs stored in memory. Instructions/data piped from memory to CPU. Basis for imperative languages. |
Second influence on language design | New programming paradigms. Machine efficiency, to structured programming, to data abstraction, to inheritance and polymorphism. |
Language categories | Imperative, functional, logic, markup/programming hybrid |
Imperative Languages | Variables, assignment statements, iteration. Object oriented programming languages as well. |
Imperative Language examples | C, C++, C sharp, Go, Java, JavaScript, Python, Rust. |
Functional languages | Making computations by applying functions to given parameters. Purest form means no memory, time, or state, just mathematical functions. |
Functional language examples | LISP, Haskell, OCaml, Erlang, Racket, Scheme, Clojure |
Logic languages | Program statements that describe facts and rules. Computer constructs proof based on axioms. |
Logic language example | prolog |
markup/programming hybrid languages | Extends or supports some programming |
markup/programming hybrid language examples | HTML and JSTL, XML and XSLT |
Implementation methods | Compilation, pure interpretation, hybrid systems |
Compilation | programs translated into machine language |
Compilation phases | 1. Lexical analysis, turn character into lexical units. 2. syntax analysis, lexical units into parse tree. 3. semantics analysis, type checking and intermediate code generation. 4. code generation. |
Pure interpretation | programs are interpreted/executed in a stepwise fashion by an interpreter |
Pure interpretation advantages | Execution is immediate. Easier implementation of debugging. |
Pure interpretation disadvantages | Errors not found until executed. Slower execution. Usually requires more space. |
Hybrid | A language that is translated into an intermediate language and then into machine code. Faster than pure interpretation. |
Hybrid example | Java virtual machine. Uses byte code to provide portability. |
Just-in-time implementation systems | The intermediate language of methods is translated to machine code when they become hot. Machine code is kept for subsequent calls |
Just-in-time implementation system examples | Java, MATLAB, Python, .NET languages |
Fortran development environment | Small memories and unreliable. Scientific applications. No programming methods or tools. Machine efficiency was primary concern. |
Fortran important facts | Implemented for IBM machine. Anything more than 400 lines usually didn't work. Code was fast. Quickly became widely used. |
Fortran starting features | Loops, three way if statements |
Fortran evaluation | Highly optimizing compilers, types and storage fixed before runtime. Dramatically changed how computer are used. |