design implementation overview
play

Design & Implementation Overview language design Language as - PowerPoint PPT Presentation

P rogramming L anguages Design & Im- plementation Overview COS 301 Influences on Design & Implementation Overview language design Language as VM Compilation COS 301 Interpretation Hybrid imple- mentation Fall 2017


  1. P rogramming L anguages Design & Im- plementation Overview COS 301 Influences on Design & Implementation Overview language design Language as VM Compilation COS 301 Interpretation Hybrid imple- mentation Fall 2017 Preprocessors Programming environments COS 301 Design & Implementation Overview

  2. P rogramming Outline L anguages Design & Im- plementation Influences on language design 1 Overview COS 301 Language as VM 2 Influences on language design Compilation 3 Language as VM Compilation Interpretation 4 Interpretation Hybrid imple- Hybrid implementation 5 mentation Preprocessors Preprocessors 6 Programming environments Programming environments 7 COS 301 Design & Implementation Overview

  3. P rogramming L anguages Design & Im- plementation Overview COS 301 Influences on language design Influences on language design Language as VM Compilation Interpretation Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

  4. P rogramming Ontological commitments L anguages Design & Im- plementation Imperative languages Overview COS 301 Architecture: Influences on Memory cells � variables language design Data movement (memory → memory, CPU → memory) � Language as assignment VM Sequential machine instruction execution � sequential Compilation statements Interpretation Conditional execution � if-then-else constructs, Hybrid imple- goto mentation Iteration via conditionals + jump � loops Preprocessors Programming environments COS 301 Design & Implementation Overview

  5. P rogramming Ontological commitments L anguages Design & Im- plementation Functional languages Overview COS 301 Variables “standing for” value � binding, not pointers/addresses Influences on language design Function application → produce new values � Language as No notion of “executing” sequential statements VM No statements, only functions (with values) Compilation Function composition as major characteristic Interpretation Recursion as primary way of repeating function Hybrid imple- mentation application Preprocessors Programming environments COS 301 Design & Implementation Overview

  6. P rogramming Ontological commitments L anguages Design & Im- plementation Object-oriented languages Overview COS 301 World consists of objects � classes, instances, inheritance, instantiation Influences on language design No notion of address: variables hold value or references Language as VM ∃ classes of objects � inheritance, instantiation Compilation Instance variables as properties or relations to other objects Interpretation Objects affordances (things they can do) � methods Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

  7. P rogramming Factors affecting design: early (< mid-1960s) L anguages Design & Im- plementation Computer time extremely valuable Overview COS 301 ≫ programmers’ time � languages tailored toward machine, not humans Influences on language design Computers relatively slow Language as VM Thousands–millions of instructions/s (kIPS – MIPS) Compilation E.g.: IBM 360 mainframe, mid-60s, ~ 34 kIPS – ~ 17 MIPS Interpretation � extreme concern for efficiency Hybrid imple- mentation � compilation rather than interpretation Preprocessors � simple languages Programming environments Relatively simple applications � small programs COS 301 Design & Implementation Overview

  8. P rogramming Factors affecting design: late 60s–mid-70s L anguages Design & Im- Cheaper processors � cost of programmer time ≫ plementation Overview computer time COS 301 Demand for capable/sophisticated software applications � Influences on More programming time language design Larger programs � harder to design, debug, maintain Language as VM Result: Compilation Focus on Interpretation Human-friendly languages Hybrid imple- Languages supporting design, debugging, maintenance mentation Structured programming: Preprocessors Top-down design Programming Stepwise refinement environments More sophisticated control structures Prominence of ALGOL-like languages (PL/I, C, Pascal, etc.) COS 301 Design & Implementation Overview

  9. P rogramming Factors affecting design: more recently L anguages Design & Im- plementation Data abstraction (Modula-2, Ada, etc.) Overview COS 301 Object-orientation Influences on Revived early work on CLU, Smalltalk, etc. language design C++, Objective-C, Java. . . Language as VM More powerful computers � Compilation More sophisticated compilers possible � more Interpretation sophisticated/complex languages Hybrid imple- Practical interpreters � rapid prototyping/incremental mentation (iterative) development Preprocessors Programming Widespread availability of multi-core systems, clusters � environments new languages (C*, StarLisp, Parallel Euclid,. . . ) COS 301 Design & Implementation Overview

  10. P rogramming L anguages Design & Im- plementation Overview COS 301 Influences on language design Language as VM Language as VM Compilation Interpretation Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

  11. P rogramming Virtual machine L anguages Design & Im- plementation Programming language ⇒ virtual machine Overview COS 301 VM can be implemented as a compiler, interpreter or a hybrid Influences on language design Language as VM Compilation Interpretation Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

  12. P rogramming Virtual machine: layers L anguages Design & Im- plementation Overview COS 301 Influences on language design Language as VM Compilation Interpretation Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

  13. P rogramming L anguages Design & Im- plementation Overview COS 301 Influences on language design Compilation Language as VM Compilation Interpretation Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

  14. P rogramming Compilation L anguages Design & Im- plementation Compiler: program that translates HLL ⇒ object code Overview COS 301 Link editor: Influences on Gathers multiple object modules (e.g., subprograms, language design libraries) Language as Patches (links) unresolved references in object modules VM ⇒ executable Compilation Interpretation Loader: Hybrid imple- Part of OS mentation Allocates (virtual) memory Preprocessors Loads (copies) executable file into (virtual) memory Programming environments May treat parts of executable differently May create memory not present in executable (heap, uninitialized data) COS 301 Design & Implementation Overview

  15. P rogramming Overview L anguages Design & Im- Source (HLL) program → lexical analyzer plementation Overview ⇒ lexical units COS 301 Updates symbol table Influences on Lexical units → syntax analyzer language design Checks syntax for errors Language as Updates symbol table VM ⇒ parse tree Compilation Parse tree → intermediate code generator Interpretation Semantic analyzer Hybrid imple- mentation ⇒ intermediate code Preprocessors Interacts with optimizer Programming Intermediate code → code generator environments ⇒ object code file Machine language program May have unresolved references COS 301 Design & Implementation Overview

  16. P rogramming Process L anguages Source Code Design & Im- plementation Overview COS 301 Lexical Analyzer Influences on language lexical units design Language as Syntax Analyzer VM Compilation parse tree Interpretation Intermediate Hybrid imple- Symbol Table Optimizer Code Generator mentation Preprocessors intermediate code Programming environments Code Generator Object File COS 301 Design & Implementation Overview

  17. P rogramming Properties L anguages Design & Im- plementation Fast execution Overview COS 301 Running at native machine speed Optimizer ⇒ often faster than hand-coded assembly Influences on language Compiler has access to entire program at once design Language as Can do global optimizations VM Can have complex languages, easy forward references, Compilation etc. Interpretation Possibly lengthy compilation time Hybrid imple- mentation Amortized over execution times, ameliorated by faster Preprocessors machines Programming But during debugging/rapid prototyping environments compile–test cycle cumbersome source level debugging somewhat difficult hard to change part without recompiling whole COS 301 Design & Implementation Overview

  18. P rogramming L anguages Design & Im- plementation Overview COS 301 Influences on language design Interpretation Language as VM Compilation Interpretation Hybrid imple- mentation Preprocessors Programming environments COS 301 Design & Implementation Overview

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend