2 Topics Influences on Language Design Language Categories Language Design Trade-OffsImplementation MethodsProgramming Environments
3 Influences on Language Design Computer ArchitectureLanguages are developed around the prevalent computer architecture, known as the von Neumann architectureProgram Design MethodologiesNew software development methodologies (e.g., object-oriented software development) led to new programming paradigms and by extension, new programming languagesVon Neumann: Data and programs stored in the same memory
4 Computer Architecture Influence Well-known computer architecture: Von NeumannImperative languages, most dominant, because of von Neumann computersData and programs stored in memoryMemory is separate from CPUInstructions and data are piped from memory to CPUBasis for imperative languagesVariables model memory cellsAssignment statements model pipingIteration is efficient
5 The von Neumann Architecture How do we model memory cells in imperative languages?How do we model piping from memory to cpu?Iteration vs recursion in the von Neuman architecture
7 Programming Methodologies Influences 1950s and early 1960s: Simple applications; worry about machine efficiencyLate 1960s: People efficiency became important; readability, better control structuresstructured programmingtop-down design and step-wise refinementLate 1970s: Process-oriented to data-orienteddata abstractionMiddle 1980s: Object-oriented programmingData abstraction + inheritance + polymorphismData: the new currency
9 Language Design Trade-Offs Reliability vs. cost of executionExample: Java demands all references to array elements be checked for proper indexing, which leads to increased execution costsReadability vs. writabilityExample: APL provides many powerful operators (and a large number of new symbols), allowing complex computations to be written in a compact program but at the cost of poor readabilityWritability (flexibility) vs. reliabilityExample: C++ pointers are powerful and very flexible but are unreliableWe cannot have everything: reliability AND cost
10 Implementation Methods CompilationPrograms are translated into machine language; includes JIT systemsUse: Large commercial applicationsPure InterpretationPrograms are interpreted by another program known as an interpreterUse: Small programs or when efficiency is not an issueHybrid Implementation SystemsA compromise between compilers and pure interpretersUse: Small and medium systems when efficiency is not the first concern
11 Layered View of Computer The operating system and language implementation are layered overmachine interface of a computer
12 CompilationTranslate high-level program (source language) into machine code (machine language)Slow translation, fast executionCompilation process has several phases:lexical analysis: converts characters in the source program into lexical unitssyntax analysis: transforms lexical units into parse trees which represent the syntactic structure of programSemantics analysis: generate intermediate codecode generation: machine code is generatedThe lexical analyzer gathers the characters of the source program into lexicalunits. The lexical units of a program are identifiers, special words, operators,and punctuation symbols. The lexical analyzer ignores comments in the sourceprogram because the compiler has no use for them.The syntax analyzer takes the lexical units from the lexical analyzer and usesthem to construct hierarchical structures called parse trees.Why is the tree structure appropriate for this application?
14 Additional Compilation Terminologies Load module (executable image): the user and system code togetherLinking and loading: the process of collecting system program units and linking them to a user programThe linking operationconnects the user program to the system programs by placing the addresses ofthe entry points of the system programs in the calls to them in the user program.The user and system code together are sometimes called a load module,or executable image. The process of collecting system programs and linkingthem to user programs is called linking and loading, or sometimes just linking.It is accomplished by a systems program called a linker.
15 Von Neumann Bottleneck Connection speed between a computer’s memory and its processor determines the speed of a computerProgram instructions often can be executed much faster than the speed of the connection; the connection speed thus results in a bottleneckKnown as the von Neumann bottleneck; it is the primary limiting factor in the speed of computersSolution to Von Neuman Bottleneck?
18 Hybrid Implementation Systems A compromise between compilers and pure interpretersA high-level language program is translated to an intermediate language that allows easy interpretationFaster than pure interpretationExamplesPerl programs are partially compiled to detect errors before interpretationInitial implementations of Java were hybrid; the intermediate form, byte code, provides portability to any machine that has a byte code interpreter and a run-time system (together, these are called Java Virtual Machine)
20 Just-in-Time Implementation Systems Initially translate programs to an intermediate languageThen compile the intermediate language of the subprograms into machine code when they are calledMachine code version is kept for subsequent callsJIT systems are widely used for Java programs.NET languages are implemented with a JIT systemIn essence, JIT systems are delayed compilers
21 PreprocessorsPreprocessor macros (instructions) are commonly used to specify that code from another file is to be includedA preprocessor processes a program immediately before the program is compiled to expand embedded preprocessor macrosA well-known example: C preprocessorexpands #include, #define, and similar macros
22 Programming Environments A collection of tools used in software developmentUNIXAn older operating system and tool collectionNowadays often used through a GUI (e.g., CDE, KDE, or GNOME) that runs on top of UNIXMicrosoft Visual Studio.NETA large, complex visual environmentUsed to build Web applications and non-Web applications in any .NET languageNetBeans, EclipseRelated to Visual Studio .NET, except for applications in Java
23 SummaryMajor influences on language design have been machine architecture and software development methodologiesThe major methods of implementing programming languages are: compilation, pure interpretation, and hybrid implementation