Generating Processors from Specifications of Instruction Sets

Total Page:16

File Type:pdf, Size:1020Kb

Generating Processors from Specifications of Instruction Sets Generating Processors from Specications of Instruction Sets Dissertation A thesis submitted to the Faculty of Electrical Engineering, Computer Science, and Mathematics of the University of Paderborn in partial fulllment of the requirements for the degree of Doctor rerum naturalium (Dr. rer. nat.) by Ralf Dreesen Paderborn, September 2011 Supervisor: Prof. Dr. Uwe Kastens (University of Paderborn) Reviewer: Prof. Dr. Uwe Kastens (University of Paderborn) Prof. Dr. Marco Platzner (University of Paderborn) Prof. Dr.-Ing. Ulrich Ruckert¨ (University of Bielefeld) Additional members of committee: Prof. Dr. Franz Rammig (University of Paderborn) Dr. Matthias Fischer (University of Paderborn) Submitted: 15.09.2011 Examination: 6.12.2011 Published: 9.12.2011 Acknowledgments I would like to use this opportunity to show my gratitude to all people who supported me during this thesis. First of all, I would like to thank my adviser Professor Uwe Kastens, for the support and guidance he gave me and which significantly contributed to the quality of this thesis. Professor Kastens allowed me great latitude in the design of the system and has shown me the right direction during numerous fruitful discussions. I want to thank Professor Ulrich Ruckert¨ and Professor Marco Platzner for their interest in my thesis and reviewing. In addition, I would like to thank Professor Ruckert¨ for the constructive cooperation with his research group. I am obliged to many of my colleagues, who accompanied me in the past years. In particular, I owe earnest thankfulness to Dr. Michael Thies for many intensive discussions during coffee break. Special thanks go to Thorsten Junge- blut for helping me in the area of hardware design and giving me access to the respective infrastructure. I would like to show my gratitude to Friederike Sudholt and Paul Jaessing for proof reading, in particular as the subject is far away from their profession. My personal thanks go to Johanna Sudholt, who has supported me throughout this thesis, as she has done for the past 12 years. I am thankful to my parents for giving me advice and virtues for my life. Paderborn, 15.09.2011 Ralf Dreesen Abstract Most digital systems include microprocessors, as they are very flexible. Some of these microprocessors are tailored to the respective area of application, to optimize execution time and power consumption. An efficient development of such processors necessitates convenient development tools. This thesis contributes a specification language called ViDL and two gen- erators for rapid development of application specific processors. A developer specifies an instruction set in ViDL, then generates an instruction set simulator as well as a microarchitectural processor implementation from that specifica- tion. ViDL provides powerful concepts to specify a wide range of instruction sets at a high level of abstraction. For instance, the pipeline and its control are not defined by the developer, but contributed automatically by the processor generator. To demonstrate the power of ViDL, real world instruction sets, such as MIPS, ARM, Power and CoreVA have been specified. A ViDL specification is very similar to instruction set manuals, which allows for rapid formalization (e.g. one day for MIPS). The generated high speed simulators execute 60 million instructions per sec- ond (Mips) on average with a peak performance of 140Mips. The generated processor implementations yield a clock frequency of 600MHz on a 65nm ST Microelectronics low power technology. The processor generator produces a pipelined n-stage microarchitecture, where n is automatically derived from a user defined target clock frequency (e.g. 600MHz) and instruction semantics. As a result, different microarchitectural implementations (e.g. 2-stage and 6- stage) can be generated at no extra effort. All processors and the simulator are guaranteed to be consistent, as they are generated from the very same specifi- cation. There is no way that a ViDL user can break this consistency, neither by mistake nor by intention. To prove the fitness of ViDL for design space exploration (DSE) and in- struction set extension (ISE), a new application specific processor has been developed as part of this thesis. The processor called DNACore is based on MIPS and includes a sophisticated SIMD instruction set extension to acceler- ate the Smith-Waterman algorithm. The algorithm is used in bioinformatics to align DNA, RNA and protein sequences. The generated processor is freely programmable and achieves a throughput of 2.6 billion cell updates per second (GCUPS) at an estimated power consumption of only 0.05W. Zusammenfassung Viele digitale Systeme beinhalten Mikroprozessoren, weil sie aufgrund ihrer Pro- grammierbarkeit sehr flexibel einsetzbar sind. Einige dieser Mikroprozessoren sind auf den jeweiligen Anwendungsbereich zugeschnitten, um die Ausfuhrungs-¨ geschwindigkeit von Programmen zu steigern und Energie zu sparen. Eine effizi- ente Entwicklung solcher anwendungsspezifischer Prozessoren bedarf geeigneter Entwicklungswerkzeuge. Dazu tr¨agt diese Arbeit, sowohl durch die Spezifikationssprache ViDL, als auch durch zwei Generatoren zur schnellen Entwicklung anwendungsspezifischer Prozessoren bei. Ein Entwickler spezifiziert einen Instruktionssatz in ViDL und generiert daraus einen Simulator, als auch eine mikroarchitektonische Implemen- tierung eines Prozessors. ViDL verfugt¨ uber¨ m¨achtige Konzepte, um eine Viel- zahl an Instruktionss¨atzen auf einem hohen Abstraktionsniveau zu spezifizieren. So werden zum Beispiel die Pipeline und ihre Kontrolle nicht durch den Entwick- ler definiert, sondern automatisch durch den Generator aus dem Instruktions- satz hergeleitet. Um die praktische Anwendbarkeit von ViDL zu demonstrieren, wurden reale Instruktionss¨atze wie ARM, MIPS, Power und CoreVA spezifiziert und entsprechende Simulatoren und Prozessoren generiert. Eine ViDL Spezifika- tion ist der Notation in Instruktionssatz-Handbuchern¨ sehr ¨ahnlich und erlaubt deshalb eine schnelle Formalisierung (z.B. einen Tag fur¨ MIPS). Der generierte Simulator fuhrt¨ durchschnittlich 60 Millionen Instruktionen pro Sekunde (Mips) aus, mit einer Spitzengeschwindigkeit von 140Mips. Ge- nerierte Prozessoren erreichen eine Geschwindigkeit von ca. 600 MHz fur¨ eine 65nm STMicroelectronics low power Technologie. Der Prozessorgenerator er- zeugt eine n-stufige Pipeline, wobei n automatisch anhand einer vom Benut- zer gegebenen Zielfrequenz ermittelt wird (z.B. 600MHz). Folglich k¨onnen ohne zus¨atzlichen Aufwand verschiedenste mikroarchitektonische Implementierungen generiert werden. Alle Prozessoren und der Simulator sind garantiert konsistent, weil sie vollautomatisch aus derselben Spezifikation erzeugt werden. Ein ViDL Entwickler kann diese Konsistenz nicht verletzen, weder unbeabsichtigt noch vors¨atzlich. Die Eignung ViDLs zur Exploration von Entwurfsr¨aumen und Erweiterung von Instruktionss¨atzen wurde durch die Entwicklung eines anwendungsspezifi- schen Prozessors im Rahmen dieser Arbeit nachgewiesen. Der Prozessor namens DNACore basiert auf MIPS und wurde durch einen Satz anspruchsvoller SIMD Instruktionen erweitert, die die Ausfuhrung¨ des Smith-Waterman Algorithmus erheblich beschleunigen. Der Algorithmus wird in der Bioinformatik eingesetzt, um DNS-, RNS- und Proteinsequenzen zu analysieren. Der generierte Prozessor ist frei programmierbar und erreicht einen Durchsatz von 2.6 giga cell updates per second (GCUPS) bei einer Leistungsaufnahme von nur 0.05 W Contents 1 Introduction 15 1.1 Motivation .............................. 15 1.2 Overview ............................... 17 1.3 Processor aspects ........................... 18 1.4 Scientific contributions ........................ 19 1.4.1 Language concepts ...................... 19 1.4.2 Generation methods ..................... 20 1.5 Processor implementations ...................... 21 1.6 System overview ........................... 22 1.7 Evolution of ViDL and its generators ................ 23 1.8 Areas of expertise ........................... 24 2 Fundamentals 27 2.1 Instruction set architectures ..................... 27 2.1.1 ARM ............................. 28 2.1.2 MIPS ............................. 29 2.1.3 OISC — One instruction set computer ........... 30 2.2 Design scenarios ........................... 30 2.3 Domain specific languages ...................... 32 2.4 Compilation methods ........................ 34 2.4.1 Front-end ........................... 35 2.4.2 Middle-end .......................... 36 2.4.3 Back-end ........................... 36 2.4.4 Compiler framework ..................... 37 2.5 Type systems ............................. 37 2.5.1 Subtyping ........................... 38 2.5.2 Tuples ............................. 38 2.5.3 Signatures ........................... 38 2.5.4 Polymorphic types ...................... 39 2.5.5 Polymorphic functions .................... 39 2.6 Term rewriting systems ....................... 39 2.6.1 Term .............................. 39 2.6.2 Rewrite rules ......................... 40 2.6.3 Termination and confluence ................. 40 10 CONTENTS 2.7 Microarchitecture ........................... 40 2.7.1 Storages ............................ 41 2.7.2 Datapath ........................... 42 2.7.3 Pipeline ............................ 43 2.7.4 Execution order ........................ 44 2.7.5 Forwarding .......................... 44 2.7.6 Interlocking .......................... 45 2.7.7 Branch prediction ...................... 46 3 Related approaches 49 3.1 Taxonomy of ISA specification languages
Recommended publications
  • Structured Recursion for Non-Uniform Data-Types
    Structured recursion for non-uniform data-types by Paul Alexander Blampied, B.Sc. Thesis submitted to the University of Nottingham for the degree of Doctor of Philosophy, March 2000 Contents Acknowledgements .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 1 Chapter 1. Introduction .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 2 1.1. Non-uniform data-types .. .. .. .. .. .. .. .. .. .. .. .. 3 1.2. Program calculation .. .. .. .. .. .. .. .. .. .. .. .. .. 10 1.3. Maps and folds in Squiggol .. .. .. .. .. .. .. .. .. .. .. 11 1.4. Related work .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 14 1.5. Purpose and contributions of this thesis .. .. .. .. .. .. .. 15 Chapter 2. Categorical data-types .. .. .. .. .. .. .. .. .. .. .. .. 18 2.1. Notation .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 19 2.2. Data-types as initial algebras .. .. .. .. .. .. .. .. .. .. 21 2.3. Parameterized data-types .. .. .. .. .. .. .. .. .. .. .. 29 2.4. Calculation properties of catamorphisms .. .. .. .. .. .. .. 33 2.5. Existence of initial algebras .. .. .. .. .. .. .. .. .. .. .. 37 2.6. Algebraic data-types in functional programming .. .. .. .. 57 2.7. Chapter summary .. .. .. .. .. .. .. .. .. .. .. .. .. 61 Chapter 3. Folding in functor categories .. .. .. .. .. .. .. .. .. .. 62 3.1. Natural transformations and functor categories .. .. .. .. .. 63 3.2. Initial algebras in functor categories .. .. .. .. .. .. .. .. 68 3.3. Examples and non-examples .. .. .. .. .. .. .. .. .. .. 77 3.4. Existence of initial algebras in functor categories .. .. .. .. 82 3.5.
    [Show full text]
  • Binary Search Trees
    Introduction Recursive data types Binary Trees Binary Search Trees Organizing information Sum-of-Product data types Theory of Programming Languages Computer Science Department Wellesley College Introduction Recursive data types Binary Trees Binary Search Trees Table of contents Introduction Recursive data types Binary Trees Binary Search Trees Introduction Recursive data types Binary Trees Binary Search Trees Sum-of-product data types Every general-purpose programming language must allow the • processing of values with different structure that are nevertheless considered to have the same “type”. For example, in the processing of simple geometric figures, we • want a notion of a “figure type” that includes circles with a radius, rectangles with a width and height, and triangles with three sides: The name in the oval is a tag that indicates which kind of • figure the value is, and the branches leading down from the oval indicate the components of the value. Such types are known as sum-of-product data types because they consist of a sum of tagged types, each of which holds on to a product of components. Introduction Recursive data types Binary Trees Binary Search Trees Declaring the new figure type in Ocaml In Ocaml we can declare a new figure type that represents these sorts of geometric figures as follows: type figure = Circ of float (* radius *) | Rect of float * float (* width, height *) | Tri of float * float * float (* side1, side2, side3 *) Such a declaration is known as a data type declaration. It consists of a series of |-separated clauses of the form constructor-name of component-types, where constructor-name must be capitalized.
    [Show full text]
  • Recursive Type Generativity
    Recursive Type Generativity Derek Dreyer Toyota Technological Institute at Chicago [email protected] Abstract 1. Introduction Existential types provide a simple and elegant foundation for un- Recursive modules are one of the most frequently requested exten- derstanding generative abstract data types, of the kind supported by sions to the ML languages. After all, the ability to have cyclic de- the Standard ML module system. However, in attempting to extend pendencies between different files is a feature that is commonplace ML with support for recursive modules, we have found that the tra- in mainstream languages like C and Java. To the novice program- ditional existential account of type generativity does not work well mer especially, it seems very strange that the ML module system in the presence of mutually recursive module definitions. The key should provide such powerful mechanisms for data abstraction and problem is that, in recursive modules, one may wish to define an code reuse as functors and translucent signatures, and yet not allow abstract type in a context where a name for the type already exists, mutually recursive functions and data types to be broken into sepa- but the existential type mechanism does not allow one to do so. rate modules. Certainly, for simple examples of recursive modules, We propose a novel account of recursive type generativity that it is difficult to convincingly argue why ML could not be extended resolves this problem. The basic idea is to separate the act of gener- in some ad hoc way to allow them. However, when one considers ating a name for an abstract type from the act of defining its under- the semantics of a general recursive module mechanism, one runs lying representation.
    [Show full text]
  • Data Structures Are Ways to Organize Data (Informa- Tion). Examples
    CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 1 ] What are Data Structures? Data structures are ways to organize data (informa- tion). Examples: simple variables — primitive types objects — collection of data items of various types arrays — collection of data items of the same type, stored contiguously linked lists — sequence of data items, each one points to the next one Typically, algorithms go with the data structures to manipulate the data (e.g., the methods of a class). This course will cover some more complicated data structures: how to implement them efficiently what they are good for CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 2 ] Abstract Data Types An abstract data type (ADT) defines a state of an object and operations that act on the object, possibly changing the state. Similar to a Java class. This course will cover specifications of several common ADTs pros and cons of different implementations of the ADTs (e.g., array or linked list? sorted or unsorted?) how the ADT can be used to solve other problems CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 3 ] Specific ADTs The ADTs to be studied (and some sample applica- tions) are: stack evaluate arithmetic expressions queue simulate complex systems, such as traffic general list AI systems, including the LISP language tree simple and fast sorting table database applications, with quick look-up CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 4 ] How Does C Fit In? Although data structures are universal (can be imple- mented in any programming language), this course will use Java and C: non-object-oriented parts of Java are based on C C is not object-oriented We will learn how to gain the advantages of data ab- straction and modularity in C, by using self-discipline to achieve what Java forces you to do.
    [Show full text]
  • Recursive Type Generativity
    JFP 17 (4 & 5): 433–471, 2007. c 2007 Cambridge University Press 433 doi:10.1017/S0956796807006429 Printed in the United Kingdom Recursive type generativity DEREK DREYER Toyota Technological Institute, Chicago, IL 60637, USA (e-mail: [email protected]) Abstract Existential types provide a simple and elegant foundation for understanding generative abstract data types of the kind supported by the Standard ML module system. However, in attempting to extend ML with support for recursive modules, we have found that the traditional existential account of type generativity does not work well in the presence of mutually recursive module definitions. The key problem is that, in recursive modules, one may wish to define an abstract type in a context where a name for the type already exists, but the existential type mechanism does not allow one to do so. We propose a novel account of recursive type generativity that resolves this problem. The basic idea is to separate the act of generating a name for an abstract type from the act of defining its underlying representation. To define several abstract types recursively, one may first “forward-declare” them by generating their names, and then supply each one’s identity secretly within its own defining expression. Intuitively, this can be viewed as a kind of backpatching semantics for recursion at the level of types. Care must be taken to ensure that a type name is not defined more than once, and that cycles do not arise among “transparent” type definitions. In contrast to the usual continuation-passing interpretation of existential types in terms of universal types, our account of type generativity suggests a destination-passing interpretation.
    [Show full text]
  • Compositional Data Types
    Compositional Data Types Patrick Bahr Tom Hvitved Department of Computer Science, University of Copenhagen Universitetsparken 1, 2100 Copenhagen, Denmark {paba,hvitved}@diku.dk Abstract require the duplication of functions which work both on general and Building on Wouter Swierstra’s Data types `ala carte, we present a non-empty lists. comprehensive Haskell library of compositional data types suitable The situation illustrated above is an ubiquitous issue in com- for practical applications. In this framework, data types and func- piler construction: In a compiler, an abstract syntax tree (AST) tions on them can be defined in a modular fashion. We extend the is produced from a source file, which then goes through different existing work by implementing a wide array of recursion schemes transformation and analysis phases, and is finally transformed into including monadic computations. Above all, we generalise recur- the target code. As functional programmers, we want to reflect the sive data types to contexts, which allow us to characterise a special changes of each transformation step in the type of the AST. For ex- yet frequent kind of catamorphisms. The thus established notion of ample, consider the desugaring phase of a compiler which reduces term homomorphisms allows for flexible reuse and enables short- syntactic sugar to the core syntax of the object language. To prop- cut fusion style deforestation which yields considerable speedups. erly reflect this structural change also in the types, we have to create We demonstrate our framework in the setting of compiler con- and maintain a variant of the data type defining the AST for the core struction, and moreover, we compare compositional data types with syntax.
    [Show full text]
  • 4. Types and Polymorphism
    4. Types and Polymorphism Oscar Nierstrasz Static types ok Semantics ok Syntax ok Program text Roadmap > Static and Dynamic Types > Type Completeness > Types in Haskell > Monomorphic and Polymorphic types > Hindley-Milner Type Inference > Overloading References > Paul Hudak, “Conception, Evolution, and Application of Functional Programming Languages,” ACM Computing Surveys 21/3, Sept. 1989, pp 359-411. > L. Cardelli and P. Wegner, “On Understanding Types, Data Abstraction, and Polymorphism,” ACM Computing Surveys, 17/4, Dec. 1985, pp. 471-522. > D. Watt, Programming Language Concepts and Paradigms, Prentice Hall, 1990 3 Conception, Evolution, and Application of Functional Programming Languages http://scgresources.unibe.ch/Literature/PL/Huda89a-p359-hudak.pdf On Understanding Types, Data Abstraction, and Polymorphism http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf Roadmap > Static and Dynamic Types > Type Completeness > Types in Haskell > Monomorphic and Polymorphic types > Hindley-Milner Type Inference > Overloading What is a Type? Type errors: ? 5 + [ ] ERROR: Type error in application *** expression : 5 + [ ] *** term : 5 *** type : Int *** does not match : [a] A type is a set of values? > int = { ... -2, -1, 0, 1, 2, 3, ... } > bool = { True, False } > Point = { [x=0,y=0], [x=1,y=0], [x=0,y=1] ... } 5 The notion of a type as a set of values is very natural and intuitive: Integers are a set of values; the Java type JButton corresponds to all possible instance of the JButton class (or any of its possible subclasses). What is a Type? A type is a partial specification of behaviour? > n,m:int ⇒ n+m is valid, but not(n) is an error > n:int ⇒ n := 1 is valid, but n := “hello world” is an error What kinds of specifications are interesting? Useful? 6 A Java interface is a simple example of a partial specification of behaviour.
    [Show full text]
  • Computing Lectures
    Computing Lectures 1 R Basics Introduction to computing/programming using slides. Using R as a pocket calculator: • arithmetic operators (+, -, *, /, and ^) • elementary functions (exp and log, sin and cos) • Inf and NaN • pi and options(digits) • comparison operators (>, >=, <, <=, ==, !=): informally introduce logicals which will be discussed in more detail in unit 2. Using variables: • assignment using <- (\gets"): binding symbols to values) • inspect the binding (show the value of an object) by typing the symbol (name of the object): auto-prints. Show that explicitly calling print() has the same effect. • inspect available bindings (list objects) using ls() or objects() • remove bindings (\delete objects") using rm() Using sequences: • sequences, also known as vectors, can be combined using c() • functions seq() and rep() allow efficient creation of certain patterned sequences; shortcut : • subsequences can be selected by subscripting via [, using positive (numeric) indices (positions of elements to select) or negative indices (positions of elements to drop) • can compute with whole sequences: vectorization • summary functions: sum, prod, max, min, range • can also have sequences of character strings • sequences can also have names: use R> x <- c(A = 1, B = 2, C = 3) R> names(x) [1] "A" "B" "C" R> ## Change the names. R> names(x) <- c("d", "e", "f") R> x 1 d e f 1 2 3 R> ## Remove the names. R> names(x) <- NULL R> x [1] 1 2 3 for extracting and replacing the names, aka as getting and setting Using functions: • start with the simple standard example R> hell <- function() writeLines("Hello world.") to explain the constituents of functions: argument list (formals), body, and environment.
    [Show full text]
  • Table of Contents
    A Comprehensive Introduction to Vista Operating System Table of Contents Chapter 1 - Windows Vista Chapter 2 - Development of Windows Vista Chapter 3 - Features New to Windows Vista Chapter 4 - Technical Features New to Windows Vista Chapter 5 - Security and Safety Features New to Windows Vista Chapter 6 - Windows Vista Editions Chapter 7 - Criticism of Windows Vista Chapter 8 - Windows Vista Networking Technologies Chapter 9 -WT Vista Transformation Pack _____________________ WORLD TECHNOLOGIES _____________________ Abstraction and Closure in Computer Science Table of Contents Chapter 1 - Abstraction (Computer Science) Chapter 2 - Closure (Computer Science) Chapter 3 - Control Flow and Structured Programming Chapter 4 - Abstract Data Type and Object (Computer Science) Chapter 5 - Levels of Abstraction Chapter 6 - Anonymous Function WT _____________________ WORLD TECHNOLOGIES _____________________ Advanced Linux Operating Systems Table of Contents Chapter 1 - Introduction to Linux Chapter 2 - Linux Kernel Chapter 3 - History of Linux Chapter 4 - Linux Adoption Chapter 5 - Linux Distribution Chapter 6 - SCO-Linux Controversies Chapter 7 - GNU/Linux Naming Controversy Chapter 8 -WT Criticism of Desktop Linux _____________________ WORLD TECHNOLOGIES _____________________ Advanced Software Testing Table of Contents Chapter 1 - Software Testing Chapter 2 - Application Programming Interface and Code Coverage Chapter 3 - Fault Injection and Mutation Testing Chapter 4 - Exploratory Testing, Fuzz Testing and Equivalence Partitioning Chapter 5
    [Show full text]
  • Scrap Your Boilerplate: a Practical Design Pattern for Generic Programming
    Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming Ralf Lammel¨ Simon Peyton Jones Vrije Universiteit, Amsterdam Microsoft Research, Cambridge Abstract specified department as spelled out in Section 2. This is not an un- We describe a design pattern for writing programs that traverse data usual situation. On the contrary, performing queries or transforma- structures built from rich mutually-recursive data types. Such pro- tions over rich data structures, nowadays often arising from XML grams often have a great deal of “boilerplate” code that simply schemata, is becoming increasingly important. walks the structure, hiding a small amount of “real” code that con- Boilerplate code is tiresome to write, and easy to get wrong. More- stitutes the reason for the traversal. over, it is vulnerable to change. If the schema describing the com- Our technique allows most of this boilerplate to be written once and pany’s organisation changes, then so does every algorithm that re- for all, or even generated mechanically, leaving the programmer curses over that structure. In small programs which walk over one free to concentrate on the important part of the algorithm. These or two data types, each with half a dozen constructors, this is not generic programs are much more adaptive when faced with data much of a problem. In large programs, with dozens of mutually structure evolution because they contain many fewer lines of type- recursive data types, some with dozens of constructors, the mainte- specific code. nance burden can become heavy. Our approach is simple to understand, reasonably efficient, and it handles all the data types found in conventional functional program- Generic programming techniques aim to eliminate boilerplate code.
    [Show full text]
  • Lecture 5. Data Types and Type Classes Functional Programming
    Lecture 5. Data types and type classes Functional Programming [Faculty of Science Information and Computing Sciences] 0 I function call and return as only control-flow primitive I no loops, break, continue, goto I instead: higher-order functions! Goal of typed purely functional programming: programs that are easy to reason about So far: I data-flow only through function arguments and return values I no hidden data-flow through mutable variables/state I instead: tuples! [Faculty of Science Information and Computing Sciences] 1 Goal of typed purely functional programming: programs that are easy to reason about So far: I data-flow only through function arguments and return values I no hidden data-flow through mutable variables/state I instead: tuples! I function call and return as only control-flow primitive I no loops, break, continue, goto I instead: higher-order functions! [Faculty of Science Information and Computing Sciences] 1 I high-level declarative data structures I no explicit reference-based data structures I instead: (immutable) algebraic data types! Goal of typed purely functional programming: programs that are easy to reason about Today: I (almost) unique types I no inheritance hell I instead of classes + inheritance: variant types! I (almost): type classes [Faculty of Science Information and Computing Sciences] 2 Goal of typed purely functional programming: programs that are easy to reason about Today: I (almost) unique types I no inheritance hell I instead of classes + inheritance: variant types! I (almost): type classes
    [Show full text]
  • Implementing Reflection in Nuprl
    IMPLEMENTING REFLECTION IN NUPRL A Dissertation Presented to the Faculty of the Graduate School of Cornell University in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy by Eli Barzilay January 2006 c 2006 Eli Barzilay ALL RIGHTS RESERVED IMPLEMENTING REFLECTION IN NUPRL Eli Barzilay, Ph.D. Cornell University 2006 Reflection is the ability of some entity to describe itself. In a logical context, it is the ability of a logic to reason about itself. Reflection is, therefore, placed at the core of meta-mathematics, making it an important part of formal reasoning; where it revolves mainly around syntax and semantics — the main challenge is in making the syntax of the logic become part of its semantic domain. Given its importance, it is surprising that logical computer systems tend to avoid the subject, or provide poor tools for reflective work. This is in sharp contrast to the area of programming languages, where reflection is well researched and used in a variety of ways where it plays an central role. One factor in making reflection inaccessible in logical systems is the relative difficulty that is immediately encountered when formalizing syntax: dealing with formal syntax means dealing with structures that involve bindings, and in a logical context it seems natural to use the same formal tools to describe syntax — often limiting the usability of such formalizations to specific theories and toy examples. G¨odelnumbers are an example for a reflective formalism that serves its purpose, yet is impractical as a basis for syntactical reasoning in applied systems. In programming languages, there is a simple yet elegant strategy for imple- menting reflection: instead of making a system that describes itself, the system is made available to itself.
    [Show full text]