has been in use since 1984; Sisal 2.0 [4], a new language denition, is currently under development. Sisal research and use has demonstrated the eectiv

Size: px
Start display at page:

Download "has been in use since 1984; Sisal 2.0 [4], a new language denition, is currently under development. Sisal research and use has demonstrated the eectiv"

Transcription

1 A Formal Semantics for Sisal Arrays Isabelle Attali INRIA Sophia Antipolis - BP Sophia Antipolis Cedex - France Isabelle.Attali@sophia.inria.fr Denis Caromel I3S - 650, Route des Colles BP Sophia Antipolis Cedex - France Denis.Caromel@unice.fr Yung-Syau Chen, Jean-Luc Gaudiot Dept of Electrical Engineering-Systems University of Southern California Los Angeles, CA , USA {yschen, gaudiot}@usc.edu Andrew L. Wendelborn Dept. Computer Science University of Adelaide 5005 Australia andrew@cs.adelaide.edu.au Abstract We present a formal denition of the dynamic semantics of arrays in the functional language Sisal 2.0. We adopt a logical setting: the structural operational style of Natural Semantics, using the Typol inference rules within the Centaur system, a generic programming environment. From the formal specications, a development and visualization environment for Sisal programming is generated. This semantic denition should allow for a precise comparison of array facilities in similar languages. Moreover, this work is the basis for a formal description of program transformations (e.g. parallelizations) which are crucial in the compilation techniques of functional languages such as Sisal. Keywords compiler specication and construction, executable specications, programming environments, functional language specication. 1 Introduction We present a formal denition of the dynamic semantics of arrays in the functional language Sisal 2.0 in the structural operational style of Natural Semantics; more precisely using Typol inference rules within the Centaur system, a generic programming environment. Sisal is a strongly typed, applicative, single assignment language in use on a variety of parallel processors, including conventional multiprocessors, vector machines and data-ow machines. Sisal 1.2 1

2 has been in use since 1984; Sisal 2.0 [4], a new language denition, is currently under development. Sisal research and use has demonstrated the eectiveness of the language and its implementation on a wide variety of applications [28, 26] and machines (the Optimizing Sisal Compiler (OSC) and other tools are freely available from Lawrence Livermore National Laboratory). General functional programming research has shown that considerable power of expressiveness and abstraction is oered by higher-order functions, polymorphism, overloading and type inference. Noting this, the Sisal 2.0 proposal suggests inclusion (in a limited form for the sake of eciency) of such features. Important issues thus raised are the expressiveness and soundness of these proposals, especially in the context of the powerful array operations characteristic of Sisal; here, we present an array semantics which will provide a foundation for investigation of these issues. An important design goal for Sisal is ecient programming of large-scale scientic applications. Accordingly, expressive, high-level facilities for the description and manipulation of arrays are a major aspect of the Sisal language. Arrays in Sisal are dynamic and highly exible; array bounds are determined by the expression which produces the array value. A powerful notation is provided for generating array values, for example by mapping to a subarray, specication of diagonal components, or placement according to a vector subscript. Arbitrary subarrays can be selected, or updated with new values. Arrays interact closely with loop expressions, with facilities to select appropriate values from an array as the range of a loop, and various means of packaging values produced by a loop. Sisal has, from its earliest versions, given prominence to arrays as a primary data structure. More recently, other general-purpose functional languages have incorporated array facilities capable of implementation with constant-time access to elements. Most notable of these are Id [20, 9] and Haskell [16] (although Id is not a purely functional language, it is built on a functional core which includes arrays). The design of Haskell arrays was inuenced by that of Id, hence there are strong conceptual similarites. Fundamental Haskell array primitives are: a function which constructs an array from a specication of its bounds (possibly multidimensional) and an association list of index/value pairs; a function to select an element at a given index; and a function to return index bounds. Monolithic array denition is provided by array comprehensions (syntactically similar to list comprehensions), which separately dene disjoint regions of the array. Our approach to the study and analysis of arrays is based on a formal Natural Semantics of the Sisal language [2]. Natural semantics descriptions have been extensively used to express dynamic semantics of various languages [22, 3, 19, 1], dene various translations [6], describe compiler optimizations [14], and formalize the semantics of data ow graphs [8]. We have drawn on a natural semantic characterization of Lassi [10], a preliminary investigation into the semantics of a small Sisal-like language. We expect to provide a rm foundation for understanding and evaluating parallel language design 2

3 issues, aid the elimination of ambiguities in the language, provide a valuable reference for both implementors and programmers, and facilitate comparison of Sisal with other parallel functional languages. From this semantic denition, we intend to formally dene program transformations, particularly parallelizations. The work presented here focuses on the behavior of Sisal programs involving arrays, specically generation, reference, update, and operations. Arrays aspects of the development of a Sisal 2.0 compiler are described in [11]. In the next two sections, we introduce the Centaur system with its dedicated formalism to express semantics and arrays in the Sisal programming language. Section 4 outlines the structure of the complete semantic denition. Section 5 presents the formal denition of arrays. Finally, we illustrate our approach with a view of the generated Sisal interactive environment, and conclude the paper with some directions for future work. 2 The Centaur system and Natural Semantics The Centaur system is a formal tool to model and implement all aspects of programming languages. From the specications of the syntax and the semantics of a given language, one can automatically produce a syntactic editor and interactive semantic tools (such as type checkers and interpreters) for this language. In the Centaur system, syntactic specications describe both a concrete syntax (including language keywords) and an abstract syntax (language structural constructs) for a given language. From these specications, a parser is generated which transforms a Sisal source into a well-typed abstract syntax tree. For instance, we give in Figure 1 concrete and abstract syntax for array generation. Concrete Syntax: <Array_Gen> ::= "array" <Type_Spec> "[" <Size_Descriptor> ":" <Array_Part_List> <Opt_Semicolon> "]"; array_gen(<type_spec>, <Size_Descriptor>, <Array_Part_List>) Abstract Syntax: array_gen : TYPE_SPEC SIZE_DESCR_LIST ARRAY_PART_LIST! EXPRESSION Figure 1: Concrete and abstract syntax for array generation. 3

4 Semantic specications are in an operational style, using the Natural Semantics approach [17] and its implementation using the Typol formalism [7]. The general idea of a semantic denition in Natural Semantics is to provide axioms and inference rules that characterize semantic behaviors of language constructs. Behaviors are expressed with typed sequents in a logical style close to Natural Deduction [13] and Structural Operational Semantics [21]. Language constructs (abstract syntax operators) appear in a distinguished position in sequents, called the subject. Subjects are used for type-checking, according to the type denition of the sequent called a judgement. A semantic denition is identied with a logic; reasoning with the language is proving theorems within that logic. During the proof process, structural induction on subjects is performed. Axioms and rules are used as a proof-theoretic tool to generate new facts (proof trees) from existing facts in a non-deterministic manner due to the relational style of the formalism. Thus, semantic denitions are concise, mathematically precise and directly executable. A typical Typol rule from the Sisal dynamic semantics is shown below: function_definition(fname - System: function_def(function_header(_, For_params,_), Exps)) & bind_parameters(for_params, Eff_params -> Bind_params) & function_execution(system, Bind_params - Exps : Values) Fname, Eff_params - System : Values ; Figure 2: A Typol rule. This rule expresses, reading from the denominator part to the numerator part, that the semantics of a Sisal program, given a function name Fname to execute and its eective parameters E_params, is a list of values Values provided that the function is dened in the program and the execution of the function body (a list of expressions Exps to be evaluated whithin the binding of formal and eective parameters), results in this list of values. As shown in this rule, sequents can refer to other sets (function_denition, function_execution) which makes it possible to structure the semantic denition into dierent sets, each of them dealing with related objects. 3 Sisal and Arrays Sisal programs are made up of separately compiled modules, which comprise one or more function denitions. Functions have no side-eects; computation is by application of functions to values in expressions, which may return multiple values. Basic data types are boolean, integer, real and 4

5 double real, complex and double complex, null and character. Values may be structured using array, stream, record and union types. Streams, which are potentially innite sequences with non-strict semantics, provide pipelined parallelism. Parallel and sequential loops can be expressed. A parallel loop allows generation of a range of values, with instances of a loop body potentially executing in parallel for each value in the range. A variety of reduction and masking operators are provided to extract values from loop iterations. A sequential loop form expresses loops with data dependencies between iterations. program QuickSortExample type Info = array of integer ; function QuickSort (Data : Info returns Info) if size(data) < 2 then Data % (1) else let Pivot := Data[liml(Data)] ; % (2) Low, Mid, High := for E in Data do returns % (3) array of E when E < Pivot, array of E when E = Pivot, array of E when E > Pivot end for ; in QuickSort(Low) Mid (QuickSort(High)) end let end if end function function main ( n: integer returns Info) let A1 := array integer [ 1..5 : 53, 14, 92, 10, 65 ] ; % (4) A2 := array integer [ 1..5 : [ ] A1 ] ; % (5) A3 := array integer [ 1..3, -1..1: [ i in 1..3, j in {i dot j} ] 1; % (6) [ otherwise ] 0 ]; A4 := A3 [ 2, 0 : 100]; % (7) A5 := A3 [ 1, : -100]; % (8) A6 := A1 + A2 * n; % (9) in QuickSort ( A1 A2 A5 [1,..] A6) % (10) end let end function end program Figure 3: A Sisal program. 5

6 Sisal attempts to provide a structural, or monolithic, view of arrays, so that operations can be expressed on arrays as a whole, subarrays, or slices of arrays, rather then by element by element iteration through an array, a computational structure that often confuses intent by requiring excessive use of conditionals. Syntactic elements which contribute to this expressiveness can be seen in Figure 3, presenting a Quicksort program. Array generation (lines 4, 5, 6) expresses a type specication (the element type), a size specication for each dimension of the possibly multidimensional (line 6) array specifying the lower bound, upper bound and stride (line 5) of that dimension, and an array-part list which species both placement and values of array elements. Placement specications are quite expressive: they can be used to map the values of a subarray into a geometrically dened subset of the generated array (line 5), to describe diagonal components using a dot notation (line 6), or specify arbitrary placement of values when an array is used as vector subscript. Similar notations are used in selecting from arrays (array selection and array update, lines 7,8), at the level of individual elements, rectangular subarrays, arbitrary strided diagonals, and selection of elements at positions specied in a vector subscript. Similarly, sections of an array can be selected for update (provided the selections are disjoint) with other array values of corresponding shape. Other features of Sisal arrays illustrated by the Quicksort example are: predened functions (lines 1,2), array-of part (line 3), array inx operator (line 9), subarray selection (line 10), and array concatenation (line 10). Further discussion of this example appears in Structure of the Semantics The dynamic semantic specication is written upon the abstract syntax we dened for the Sisal language. It assumes that the Sisal program is correctly typed (integration of a type-checker in our Sisal environment is planned). Computing the result of a Sisal program requires to know which value is associated with each identier (eective parameters, carried names in loops, etc). All mappings between names and values are gathered in an environment. Execution of a Sisal program results in a tuple of values, even if that tuple only contains one value. Sisal values can be constants, arrays, streams, unions, and function values (modelled as closures, which are pairs of -expression representing a function body, and an environment). In the following, we describe the structure of the environment, and we give a synopsis of the entire semantic denition of the language. 6

7 4.1 Semantic Values and Environment We dene an environment as a list of pairs composed from a name and a value. Note that this structure is dened as part of the Sisal abstract syntax (see Figure 4), and uses Sisal operators (e.g. name, function_def), as well as new operators (e.g. pair, closure, etc). CONSTANT VALUE DIM_CONTENT, VALUE ARRAY_ELT env : PAIR *! ENV pair : NAME VALUE! PAIR closure : FUNCTION_DEF ENV! VALUE stream : STREAM_ELT *! VALUE array : DIM DIM_CONTENT! VALUE dim_content : BOUNDARIES ARRAY_ELTS! DIM_CONTENT boundaries : LOWER UPPER! BOUNDARIES array_elts : ARRAY_ELT *! ARRAY_ELTS... Figure 4: Abstract Syntax for environment and values. For environment manipulation, we need to specify: (1) the adjunction of a new pair composed with a name and a (single) value and, (2) the search for a name in the environment and the retrieving of its associated value. In order to reect inheritance of surrounding scopes and hiding rules for inner scopes, new pairs are added at the front of the current environment. Because Sisal respects the principle of single assignment, this means that there is no way of changing, in an environment, the value associated to a given name. 4.2 A synopsis of the semantics The behavior of a Sisal program is expressed in terms of evaluation of the body of a main function (starting point for execution). A function body is a list of expressions which are to be evaluated in sequence and return values. Most of the rules follow the following judgement: SYSTEM, ENV - EXPRESSION : VALUES ; which can be paraphrased as: an expression evaluates to a list of values given a Sisal system, and an environment. Only for and let constructs can add new bindings in the environment thanks to their declaration part; management of environment reects inheritance of surrounding scopes, and hiding rules when a redenition occurs. 7

8 With the Typol formalism, it is possible to structure the semantic denition in separate modules, each of which deals with similar concerns. Therefore, we have a variety of Typol modules specifying the dynamic semantics of all constructs of the Sisal language. These modules can be summarized as follows: function_execution: starting point of the semantics, this module evaluates the root function given its name and its arguments; expressions: this module contains the specication of the core of the language (expressions), it contains sets for dealing with lists of expressions, identiers, constants, evaluation of operations on scalar types, and calls to other specic modules for evaluation of function invocation, stream and array operations, for or let constructs; loops: specication of the loop constructs, distribution and iterative control, and packaging of return values; streams: species stream generation, and reference; arrays: species array generation, reference and update; system_denition: specication of information to be retrieved from the program; this requires the program to be a parameter of most rules. 5 Semantic Denition for Arrays In this section, we give an overview of the strategy adopted in developing the array semantics, and we highlight the challenges in doing so over and above more conventional array descriptions. Then, we present the principles of the semantic denition for arrays, give intuitive meanings of the main modules, and on several occasions, we give judgements, rules and axioms. 5.1 An Abstract Syntax for Sisal Arrays The whole abstract syntax of the Sisal language contains 109 sorts and 172 operators. We detail in Figure 5 operator and sort denitions specically related to array constructs. Note that, in some cases, the parsing process can be ambiguous; analyzing a source fragment such as a[b], we can not know if it is a reference to a stream value or an array value. In this case, we chose to dene temporary operators like stream_or_array_ref. It is then the responsibility of the semantic denition to solve ambiguities, according to naming and visibility rules. 8

9 SELECT PLACEMENT EXPRESSION, TRIPLET, NAME_TRIPLET SELECT_PART array_gen : TYPE_SPEC SIZE_DESCR_LIST ARRAY_PART_LIST! EXPRESSION array_ref : EXPRESSION SELECT! EXPRESSION stream_or_array_ref:expression SELECT! EXPRESSION array_update : EXPRESSION UPDT_PART_LIST! EXPRESSION size_descr_list : NAMED_TRIPLET *! SIZE_DESCR_LIST named_triplet : NAME TRIPLET! NAMED_TRIPLET triplet : EXPRESSION EXPRESSION EXPRESSION! TRIPLET array_part_list : ARRAY_PART *! ARRAY_PART_LIST array_part : PLACEMENT EXPRESSION_LIST! ARRAY_PART no_placement :! PLACEMENT otherwise :! PLACEMENT select : SELECT_PART_LIST DIAG_SPEC_LIST! SELECT select_part_list : SELECT_PART +! SELECT_PART_LIST diag_spec_list : DIAG_SPEC *! DIAG_SPEC_LIST diag_spec : NAME NAME_LIST! DIAG_SPEC updt_part_list : UPDT_PART +! UPDT_PART_LIST updt_part : SELECT EXPRESSION_LIST! UPDT_PART binary : EXPRESSION REL_OP EXPRESSION! EXPRESSION name : identier! EXPRESSION... Figure 5: Abstract Syntax for array constructs. 5.2 Comparison of Array Designs The design of Sisal 1.2 arrays is based on the one-dimensional array model. Under its semantics, arrays are constructed by the concatenation of the inner dimension arrays to build a single onedimensional array. This model enables optimizations such as vectorization to be easily exploited because a multi-dimensional array is indeed represented as a vector containing vectors. Thus the construct of arrays is uniform. The disadvantages of this array design are (1) arrays must be stored in contiguous memory and (2) the inner vectors must always have the same size. For some applications, this is not exible enough. To fully utilize the advantages of one-dimensional array and avoid the disadvantages, the design of Sisal 2.0 array should allow both one-dimensional arrays and real multi-dimensional semantics. In the semantics for the multi-dimensional arrays, the subarrays inside arrays can have dierent sizes. For example, the following array can be handled in Sisal 2.0 array semantics: array real [1..2,1..2: [2,..] array real [1.0, 2.0]; [1,..] array real [3.0, 4.0, 5.0]; ] 9

10 The results for the above Sisal 2.0 array in our Centaur environment is as follows: [ [ ] [ ] ] This array cannot be represented in a Sisal 1.2 program. The design of Sisal 2.0 arrays contains many constructs which are convenient for users. These utilities in turn appear to be challenges for semantic specications of Sisal Design Challenges The design of Sisal 2.0 arrays are intended to make the task of programming easier by allowing versatile syntax utilities. More convenience for programmers means more challenges in semantic specications. Thus using Centaur, we have to write wise Typol rules to manipulate these versatile semantics of arrays. We will show several array construct examples to illustrate the challenges: B := array integer [7..8:30,40]; C := array integer [7..8:50,60]; A := array real [2..3,..8:[2,..] B; [3,..] C]; In this case, our semantics must compute the size of B and C then place their elements in the appropriate position. Also the number 7 omitted in the index descriptor of array A must be detected by the semantic rules. A := array real [2..3,7..8:[2,..] B; [3,..] 0]; Our semantics expressed in Typol rules must recognize the number '0' and put the appropriate number (here specied as 3) of zeroes in the array. A3 := array real [1..2,1..2,1..2,1..2: [1,1,1,1] 3.0; [1,1,1,2] 4.0; [1,1,2,1] 5.0; [1,1,2,2] 6.0; [1,2,1,2] 12.12; [2,2,1,2] 22.12; [2,2,2,2] 7.0; [otherwise] ]; Our Typol rules must avoid overwriting the positions which are lled with the available values when inserting the value (3.1416) specied in "otherwise". In our specication, the Typol rules ll the array construct with the otherwise value rst then overwrite the positions which are specied with values (e.g. 3.0) in the array. 10

11 let A15 := array integer[1,4,2]; in array real [1..3,1..4: [1,A15] 11.1, 14.4, 12.2; [2,A15] 21.1, 24.4, 22.2; [otherwise] 99.9] end let In this array reference, array indices can be specied by a predened array, e.g. A15. Our Typol rules must recognize that the index is an array name and then fetch the element from that array (A15) to feed into the index-descriptor to serve as position indices. A2 := array real [2..3,7..8:[2,..] array real [1.0, 2.0]; [3,..] array real [3.0, 4.0]]; In this example, an inner array is created inside the array A2. Typol rules must identify that this is an array creation instead of one single element, so that the inner array elements will be inserted into the correct positions (there may be more than one position) in the array A2. A one-dimensional array whose elements are one-dimensional arrays is never conformable with a two-dimensional array (p 30 of the Sisal 2.0 Reference Manual [4]). Then, we have to distinguish the above two in in our description of Sisal 2.0 arrays. This makes it possible for a user to specify an array with dierent size subarrays. For example, the following array integer [1..2,7..8: [1,..] array integer [1, 2, 3]; [2,..] array integer [4, 5]; ] is a two dimensional array but not a vector-on-vector array. The execution results in our Centaur environment for the above example is: [ [1 2 3] [4 5] ] 5.4 Generation The array generation semantics (Figure 3, lines 4, 5, 6) is invoked in the following rule from the expression program: array_generation(system, Env - array_gen(type, Sizedl, Arraypl) -> Values) System, Env - array_gen(type, Sizedl, Arraypl) : Values; Then, the semantics of array generation can be written as follows: 11

12 dimension(system, Env - Sizedl : Dim, Bounds) & build_array(system, Env, Type, Dim, Bounds - Arraypl : Def_array) & fill_array(system, Env, Def_array - Arraypl : Array) System, Env - array_gen(type, Sizedl, Arraypl) : values[array] ; The set dimension species the dimension and the bounds from the size descriptor. Note that, in the absence of a size descriptor (optional for one-dimensional array), the set dimension returns 1 for the dimension, 1 for the lower bound and a free variable for the upper bound. This free variable will automatically be instantiated in the set build_array, via unication from the number of values dened in the list of array_parts. Then, we build the array itself with the set build_array, specied as : otherwise(system, Env, Type - Arraypl : Value) & build_def(system, Env, Dim, Bounds, Value - Arraypl: Def_array) System, Env, Type, Dim, Bounds - Arraypl: Def_array; The rst premise (otherwise) returns a default value from the otherwise construct. Note that this default value might be a free variable if there is no otherwise specier. Then, we actually build the array structure (Def_array) with this default value and bounds. At this point, the whole array value is built with dimension, lower and upper bounds, and all the elements set with a default value. Finally, the set ll_array examines each array_part in sequence: from the Placement son, a list of indices Indices is generated; from the Expl son, the evaluation process generates a list of values Values. Then the set update, called on Def_array with these indices and values, returns the nal array. Note that, when placement is the otherwise specier, the array is unchanged. Moreover, in the absence of placement (no_placement operator), the set select returns an empty list of indices, which means that values are lled in sequence. The semantics of ll_array is expressed as follows: set fill_array is judgement SYSTEM, ENV, VALUE - ARRAY_PART_LIST : VALUE ; System, Env, Array - array_part_list[] : Array ; 12

13 System, Env, Array - Ap : Array' & System, Env, Array' - Apl : Array'' System, Env, Array - array_part_list[ap.apl]: Array'' ; System, Env, Array - array_part(otherwise(), Expl): Array ; select(system, Env, Array - Placement : Indices) & eval_expression_list(system, Env - Expl : Values) & update(indices, Values - Array : Array') System, Env, Array - array_part(placement, Expl): Array' ; provided diff(placement, otherwise()); end fill_array; Possible position speciers include expressions, triplets, named triplets, and optional diagonal components which indicate respectively components, subscripts, and vector subscripts. Because Sisal requires each element of an array to be set, and since bounds can be dened dynamically, this verication (as well as checking intersection of size descriptors) can not be done statically and has to be specied in the dynamic semantics. 5.5 Reference Array reference semantics (Figure 3, line 10) is invoked in the following rules from the expression program. The rst rule is used to solve the abovementioned ambiguity between stream and array references and applies only if the referenced data structure is an array value (an alternative rule handles the stream case); the second rule deals with unambiguous cases: eval_expression(system, Env - Exp : values[array(dim, Dim_content)]) & array_reference(system, Env, array(dim, Dim_content) - Select -> Values) System, Env - stream_or_array_ref(exp, Select) : Values; eval_expression(system, Env - Exp : values[array(dim, Dim_content)]) & array_reference(system, Env, array(dim, Dim_content) - Select -> Values) System, Env - array_ref(exp, Select) : Values; The set select returns a list of indices from which values can be extracted from an array. 13

14 5.6 Update In Sisal, the specication of a section of an array to be updated for array updating are almost as powerful as facilities for generation and subarray selection (Figure 3, lines 7, 8). The result of an array update is a new array diering in the specied positions. Array update semantics in invoked in the expression program as follows: eval_expression(system, Env - Exp : values[array(dim, Dim_content)]) & array_update(system, Env, array(dim, Dim_content) - Updtpl -> Array') System, Env - array_update(exp, Updtpl) : values[array']; The array resulting from the evaluation of the expression has to be updated, with respect to the given selectors. Then the set array_update examines in sequence each update_part, and builds step by step a new array value. Because of the single assignment principle, the original value in the environment is unchanged. System, Env, Array - Updtp : Array' System, Env, Array - update_part_list[updtp] : Array' ; System, Env, Array - Updtp : Array' & System, Env, Array' - Updtpl : Array'' System, Env, Array - update_part_list[updtp.updtpl] : Array'' ; For each update_part, the modications are achieved on the new array, according to the selectors and the values coming from the evaluation of the expression_list. Once again, the sets select and update are used. select(system, Env, Array - Select : Indices) & eval_expression_list(system, Env - Expl : Values) & update(indices, Values - Array : Array') System, Env, Array - updt_part(select, Expl) : Array'; 14

15 5.7 Arrays in loops The for expression is the fundamental control mechanism in Sisal, and can be used to express either parallel distribution of loop bodies, or functional iteration. Clearly, the relationship between these expressions and array structures is of paramount importance in Sisal programming. A for expression with distributed control establishes notionally separate instances of its body for each value in a sequence, where the sequence can be specied as an arithmetic progression, or by scattering values from a stream or array. The indices corresponding to the scattered elements (At-part) can be named and used in the loop body. Each execution of the body of a for expression can be seen as contributing to sequences of values, corresponding to the identiers used in the loop body. Such a sequence can have its values combined (using array of) to form an array as a result of a for expression (Figure 3, line 3). The semantics of the array of part in a return part can be described in two steps. In the rst step, each execution of the body evaluates the bottom part (which may comprise several return parts) and build sequences of values for the next step according to possible masking lters (eval_lter); possible position speciers coming from the optional at-part are also evaluated (eval_at_list) and gathered for later packaging (using the concatenation operator); eval_filter(system, Env - Filter : true()) & eval_expression(system, Env - Exp : Values') System, Env, Values, _ - return_array(sizedl, Exp, Filter) : Values Values', _; eval_filter(system, Env - Filter : false()) System, Env, Values, _ - return_array(sizedl, Exp, Filter) : Values, _; eval_at_list(system, Env - Atpart : Positions') & eval_expression(system, Env - Exp : Values') System, Env, Values, Positions - return_array(sizedl, Exp, Atpart) : Values Values', Positions Positions'; The resulting array value can be dened using any of the mechanisms discussed above, so the scattering mechanism is quite expressive and powerful. In the second phase, after the last execution of the body, the packaging of these values takes place and results in the new array returned by the loop. 15

16 dimension(system, Env - Sizedl : Dim, Bounds) & build_from_values(system, Env, Dim, Bounds, _ - Values : Array) System, Env, Values, _ - return_array(sizedl, Exp, Filter) : Array dimension(system, Env - Sizedl : Dim, Bounds) & build_from_values(system, Env, Dim, Bounds, Positions - Values : Array) System, Env, Values, Positions - return_array(sizedl, Exp, Atpart) : Array; Rules dealing with lters and the rules dealing with position speciers are exclusive since a return array part may not have both lter and position specier. The choice between these two rules results from a matching on the third son of return_array. It can be either a lter (when_expression or unless_expression) or a at_list. The set build_from_values builds an array from a list of values and a list of positions speciers (when provided). 5.8 Discussion The formal specication we dened being executable, we are able to generate an interactive programming environment for Sisal and array manipulations. This environment includes structured editing, interpretation, and animation tools such as a step by step execution of the semantics (this permit to see in a given state what are the inference rules which currently apply). We give a avor of our Sisal environment in Figure 6, where the Quicksort program (Figure 3) is being evaluated. The Examine window shows the environment during the elaboration of the declaration part of the let (with n, A1, A2). We consider this example in more detail, in order to illustrate how an interpretable semantic denition can be useful to both a Sisal programmer and implementor. The function main denes several array values; the result it returns comes from the function QuickSort invoked with an argument formed by concatenating several array values. The denitions A1 to A6 illustrate (as mentioned in Section 2) dierent forms of array generation and selection. The function QuickSort exhibits parallelism in the parallel loop; an instance of the loop body is generated for each value in the array passed as argument, and three results are formed by ltering appropriate values and gathering them into each result. Section 5.7 explains how loop semantics complements array semantics. The interpreter generated by Centaur from the Typol semantics allows us to examine highlighted 16

17 Figure 6: The Sisal environment. values and expressions and the associated semantic rule. The window Examine in Figure 3 shows the environment bindings appropriate to the evaluation of the expression highlighted. The window Semantics shows the Typol rule for the evaluation of the expression associated with the name A3. It is possible, using the Edit menu, to set control points (break, skip, hide) depending on what has been selected in the window Debug Options. The interpreter allows us to step through execution, showing the current semantic rule at each step; such facilities permit convenient development of both Sisal programs and semantic rules. In the case of arrays in particular, the semantics can be readily augmented to provide more detailed visualizations of array structure, for example, a navigator of large arrays. The principles of such visualization in the context of Centaur have been explored by Lee and Wendelborn in [18], whereby the semantic rules are augmented with trace event generators to produce trace les suitable for visualization by standard visualization software such as ParaGraph [15]. 17

18 6 Conclusions and Future Work As pointed out above, our semantic denition in Typol provides, through Centaur, an interactive programming environment. Another interactive environment for Sisal is proposed in [23, 24]. However both the means and the objectives are dierent from the work presented here. Regarding the method, their system is not based on a formal description of Sisal, but rather on classical programming techniques, which explains itself with the fact that the intended goal does not include formal transformations or proofs, but instead focuses on program scheduling and assessment. Much of the Sisal 2.0 denition is concerned with powerful array and sub-array descriptions. Id and Haskell arrays dier from those of Sisal in that they are non-strict, and can be dened recursively (Sisal requires that arrays be strict, and hence forbids recursive denition). This provides very concise denition of array-based computations in some cases, but with an implementation penalty in that evaluation order must be determined at run-time (as dependencies evolve); insistence on strict arrays allows more extensive compile-time analysis (current highly ecient implementations of Sisal 1.2 owe much of their success to such analysis). Some work is underway to combine specication of evaluation order in a recursively-dened array [12]; it is hoped that such eorts will ultimately allow both recursive denition and compile-time optimization in many useful cases. An operational semantics based on reduction rules was developed for Id Nouveau, a slightly earlier version of Id. The work reported here lays the foundation for all the analysis and optimizations required for an ecient implementation of these features. Future work will include optimization tools for Sisal: we aim at specifying the IF1 [25] and IF2 [27] intermediate formats, and the transformations from one to another, again using Centaur and the Typol formalism. This comprises the translations from Sisal into the intermediate formats, the transformations themselves, and the proofs of their validity. Among possible optimizations on arrays, we wish to address the compile-time optimizations of OSC (specically the preallocation IF2MEM, and update-in-place phases IF2UP), which minimize run-time overhead due to frequent array dynamic memory allocations and array copying (caused by the referencial transparency principle). There is also a need to experiment with program transformations which are dedicated to specic parallel architectures. Thanks to these formal specications and proved transformations, we intend to permit the denition and programming of validated compilers for Sisal. 18

19 References [1] Attali I., Caromel D., Oudshoorn M. A Formal Denition of the Dynamic Semantics of the Eiel Language", Sixteenth Australian Computer Science Conference (ACSC-16), Brisbane, Australia, 1993, also Research Report I3S [2] Attali I., Caromel D. and Wendelborn A. A Formal Semantics and an Interactive Environment for Sisal, pp , in A. Zaky, editor, Tools and Environments for Parallel and Distributed Systems, to appear, Kluwer Academy Publishers, [3] Bertot Y., Implementation of an Interpreter for a Parallel Language in Centaur", 3rd European Symposium on Programming, Copenhagen, Denmark, 1990, LNCS 432. [4] B hm A. P. W., Cann D.C., Feo J.T., Oldehoeft R.R., Sisal Reference Manual (language version 2.0)", Draft Report, [5] Borras P., Cl ment D., Despeyroux T., Incerpi J., Kahn G., Lang B., Pascual V. CENTAUR: the system", in Proc. of SIGSOFT'88, Third Annual Symposium on Software Development Environments, Boston, [6] Cl ment D., Despeyroux J., Despeyroux T., Kahn G. A simple applicative language: Mini-ML", Symp. on Functional Programming Languages and Computer Architecture, 1986 [7] Despeyroux T. Typol: a formalism to implement Natural Semantics", INRIA research report 94, [8] Dion B., Angeli L., Bravo Lastra A. PARAGRAPH: an interactive environment for parallelizing FORTRAN programs", INRIA research report 1920, [9] Ekanadham, K. A Perspective on Id", in Parallel Functional Languages and Compilers" B.K. Szymanski (ed), ACM Press, [10] Errington L. Lassi Semantics", Sisal project internal report, Department of Computer Science, University of Adelaide, August [11] Fitzgerald, S. M. Copy Elimination for True Multidimensional Arrays in SISAL 2.0", in Proc. of the Third SISAL Users and Developers Conference, San Diego, October [12] Gao, G.R., Yates, R.K., Dennis, J.B., and Mullin, L.R. An Ecient Monolithic Array Constructor", ACAPS Technical Memo 19, McGill University School of Computer Science, [13] Gentzen G. Investigation into Logical Deduction, Thesis 1935, reprinted in The collected papers of Gerhard Gentzen E. Szabo, North-Holland, Amsterdam, [14] Gopinath K., Copy Elimination in Single Assignment Languages", PhD Thesis, Stanford University, 1989 (Technical Report CSL-TR ). [15] Heath M.T. and Etheridge J.A. Visualizing the Performance of Parallel Programs", IEEE Software, vol. 8, num. 5, pp 29-40, [16] Hudak P., Peyton Jones S. L., and Wadler P. L.(editors). Report on the programming language Haskell, a non-strict purely functional language (version 1.2).", SIGPLAN Notices, 27(5),

20 [17] Kahn G. Natural Semantics", in Proc. of Symp on Theoretical Aspects of Computer Science, Passau, Germany, LNCS 247, 1987 [18] Lee, K.P., IVIS: An Interpreter and a Visualizer for a Parallel Functional Programming Language, Honours Report, Department of Computer Science, University of Adelaide, [19] Milner R., Tofte M., Harper R. The Denition of Standard ML", MIT Press, [20] Nikhil, R.S. Id Language Reference Manual", TR CSG Memo 284-2, Lab. for Computer Science, MIT, [21] Plotkin G.D. A Structural Approach to Operational Semantics Report DAIMI FN-19, Computer Science Department, Aarhus University, Aarhus, Denmark, [22] Prasad S., Giacalone A., Mishra P. Operational and Algebraic Semantics of Facile: A Symmetric Integration of Concurrent and Functional Programming", in Proc. of 17th International Colloquium on Automata, Languages and Programming, Warwick University, England, Lecture Notes in Computer Science, Volume 443, Springer-Verlag, pp [23] Shirazi B., Chen H., Kavi K., Marquis J., Hurson A.R. A Software Development Tool for Parallel Program Scheduling and Assessment", in Proc. of International Parallel Processing Symposium, [24] Shirazi B., Chen H., Yeh J. S. A visualization tool for display and interpretation of Sisal Programs", in Proc. of International Conference on Parallel and Distributed Computing Systems, [25] Skedzielewski S., Glauert J. IF1 - An intermediate form for applicative languages", Manual M-170, Lawrence Livermore National Laboratory, Livermore, Calif., [26] Sohn A. A parallel implementation of the Traveling Salesman problem on a Sequent Symmetry multiprocessor", in Proc. of the IFIP WG 10.3 Working Conference on Architectures and Compilation Techniques for Fine and Medium Grain Parallelism, Jan [27] Welcome M.L., Skedzielewski S., Yates R.K., Ranelletti J. E. An applicative language intermediate form explicit memory management", Manual M-195, Lawrence Livermore National Laboratory, Livermore, Calif., [28] Wendelborn A. L., Gardsen H., Irlam G., McDonald I., Smith G. The development and ecient execution of Sisal programs", in Jean-Luc Gaudiot and Lubomir Bic, editors, Advanced Topics in Dataow Computing, Prentice Hall,

Natural Semantics [14] within the Centaur system [6], and the Typol formalism [8] which provides us with executable specications. The outcome of such

Natural Semantics [14] within the Centaur system [6], and the Typol formalism [8] which provides us with executable specications. The outcome of such A Formal Executable Semantics for Java Isabelle Attali, Denis Caromel, Marjorie Russo INRIA Sophia Antipolis, CNRS - I3S - Univ. Nice Sophia Antipolis, BP 93, 06902 Sophia Antipolis Cedex - France tel:

More information

SORT INFERENCE \coregular" signatures, they derive an algorithm for computing a most general typing for expressions e which is only slightly more comp

SORT INFERENCE \coregular signatures, they derive an algorithm for computing a most general typing for expressions e which is only slightly more comp Haskell Overloading is DEXPTIME{complete Helmut Seidl Fachbereich Informatik Universitat des Saarlandes Postfach 151150 D{66041 Saarbrucken Germany seidl@cs.uni-sb.de Febr., 1994 Keywords: Haskell type

More information

7. Introduction to Denotational Semantics. Oscar Nierstrasz

7. Introduction to Denotational Semantics. Oscar Nierstrasz 7. Introduction to Denotational Semantics Oscar Nierstrasz Roadmap > Syntax and Semantics > Semantics of Expressions > Semantics of Assignment > Other Issues References > D. A. Schmidt, Denotational Semantics,

More information

2 3. Syllabus Time Event 9:00{10:00 morning lecture 10:00{10:30 morning break 10:30{12:30 morning practical session 12:30{1:30 lunch break 1:30{2:00 a

2 3. Syllabus Time Event 9:00{10:00 morning lecture 10:00{10:30 morning break 10:30{12:30 morning practical session 12:30{1:30 lunch break 1:30{2:00 a 1 Syllabus for the Advanced 3 Day Fortran 90 Course AC Marshall cuniversity of Liverpool, 1997 Abstract The course is scheduled for 3 days. The timetable allows for two sessions a day each with a one hour

More information

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the The Semi-Full Closure of Pure Type Systems? Gilles Barthe Institutionen for Datavetenskap, Chalmers Tekniska Hogskola, Goteborg, Sweden Departamento de Informatica, Universidade do Minho, Braga, Portugal

More information

A Parallel Intermediate Representation based on. Lambda Expressions. Timothy A. Budd. Oregon State University. Corvallis, Oregon.

A Parallel Intermediate Representation based on. Lambda Expressions. Timothy A. Budd. Oregon State University. Corvallis, Oregon. A Parallel Intermediate Representation based on Lambda Expressions Timothy A. Budd Department of Computer Science Oregon State University Corvallis, Oregon 97331 budd@cs.orst.edu September 20, 1994 Abstract

More information

2 Introduction to operational semantics

2 Introduction to operational semantics 2 Introduction to operational semantics This chapter presents the syntax of a programming language, IMP, a small language of while programs. IMP is called an "imperative" language because program execution

More information

JOURNAL OF OBJECT TECHNOLOGY

JOURNAL OF OBJECT TECHNOLOGY JOURNAL OF OBJECT TECHNOLOGY Online at www.jot.fm. Published by ETH Zurich, Chair of Software Engineering JOT, 2002 Vol. 1, No. 2, July-August 2002 The Theory of Classification Part 2: The Scratch-Built

More information

On Object Orientation as a Paradigm for General Purpose. Distributed Operating Systems

On Object Orientation as a Paradigm for General Purpose. Distributed Operating Systems On Object Orientation as a Paradigm for General Purpose Distributed Operating Systems Vinny Cahill, Sean Baker, Brendan Tangney, Chris Horn and Neville Harris Distributed Systems Group, Dept. of Computer

More information

Introduction. chapter Functions

Introduction. chapter Functions chapter 1 Introduction In this chapter we set the stage for the rest of the book. We start by reviewing the notion of a function, then introduce the concept of functional programming, summarise the main

More information

to automatically generate parallel code for many applications that periodically update shared data structures using commuting operations and/or manipu

to automatically generate parallel code for many applications that periodically update shared data structures using commuting operations and/or manipu Semantic Foundations of Commutativity Analysis Martin C. Rinard y and Pedro C. Diniz z Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 fmartin,pedrog@cs.ucsb.edu

More information

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End

More information

A taxonomy of race. D. P. Helmbold, C. E. McDowell. September 28, University of California, Santa Cruz. Santa Cruz, CA

A taxonomy of race. D. P. Helmbold, C. E. McDowell. September 28, University of California, Santa Cruz. Santa Cruz, CA A taxonomy of race conditions. D. P. Helmbold, C. E. McDowell UCSC-CRL-94-34 September 28, 1994 Board of Studies in Computer and Information Sciences University of California, Santa Cruz Santa Cruz, CA

More information

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA Thunks (continued) Olivier Danvy, John Hatcli Department of Computing and Information Sciences Kansas State University Manhattan, Kansas 66506, USA e-mail: (danvy, hatcli)@cis.ksu.edu Abstract: Call-by-name

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell) Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 13 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 16 October, 2012 1 / 21 1 Types 2 3 4 2 / 21 Thus far

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

SAMOS: an Active Object{Oriented Database System. Stella Gatziu, Klaus R. Dittrich. Database Technology Research Group

SAMOS: an Active Object{Oriented Database System. Stella Gatziu, Klaus R. Dittrich. Database Technology Research Group SAMOS: an Active Object{Oriented Database System Stella Gatziu, Klaus R. Dittrich Database Technology Research Group Institut fur Informatik, Universitat Zurich fgatziu, dittrichg@ifi.unizh.ch to appear

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

which a value is evaluated. When parallelising a program, instances of this class need to be produced for all the program's types. The paper commented

which a value is evaluated. When parallelising a program, instances of this class need to be produced for all the program's types. The paper commented A Type-Sensitive Preprocessor For Haskell Noel Winstanley Department of Computer Science University of Glasgow September 4, 1997 Abstract This paper presents a preprocessor which generates code from type

More information

Khoral Research, Inc. Khoros is a powerful, integrated system which allows users to perform a variety

Khoral Research, Inc. Khoros is a powerful, integrated system which allows users to perform a variety Data Parallel Programming with the Khoros Data Services Library Steve Kubica, Thomas Robey, Chris Moorman Khoral Research, Inc. 6200 Indian School Rd. NE Suite 200 Albuquerque, NM 87110 USA E-mail: info@khoral.com

More information

Language. Institut fur Informatik, Technische Universitat Munchen. Abstract

Language. Institut fur Informatik, Technische Universitat Munchen.   Abstract Modelling Inheritance in an Algebraic Specication Language Dieter Nazareth Institut fur Informatik, Technische Universitat Munchen Postfach 20 24 20, D-8000 Munchen 2, Germany e-mail: nazareth@informatik.tu-muenchen.de

More information

Conclusions and further reading

Conclusions and further reading Chapter 18 Conclusions and further reading We have not been exhaustive in the description of the Caml Light features. We only introduced general concepts in functional programming, and we have insisted

More information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

University of Utrecht. 1992; Fokker, 1995), the use of monads to structure functional programs (Wadler,

University of Utrecht. 1992; Fokker, 1995), the use of monads to structure functional programs (Wadler, J. Functional Programming 1 (1): 1{000, January 1993 c 1993 Cambridge University Press 1 F U N C T I O N A L P E A R L S Monadic Parsing in Haskell Graham Hutton University of Nottingham Erik Meijer University

More information

Compiling and Interpreting Programming. Overview of Compilers and Interpreters

Compiling and Interpreting Programming. Overview of Compilers and Interpreters Copyright R.A. van Engelen, FSU Department of Computer Science, 2000 Overview of Compilers and Interpreters Common compiler and interpreter configurations Virtual machines Integrated programming environments

More information

Extracting the Range of cps from Affine Typing

Extracting the Range of cps from Affine Typing Extracting the Range of cps from Affine Typing Extended Abstract Josh Berdine, Peter W. O Hearn Queen Mary, University of London {berdine, ohearn}@dcs.qmul.ac.uk Hayo Thielecke The University of Birmingham

More information

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics The Compositional C++ Language Denition Peter Carlin Mani Chandy Carl Kesselman March 12, 1993 Revision 0.95 3/12/93, Comments welcome. Abstract This document gives a concise denition of the syntax and

More information

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have Program Design in PVS Jozef Hooman Dept. of Computing Science Eindhoven University of Technology P.O. Box 513, 5600 MB Eindhoven, The Netherlands e-mail: wsinjh@win.tue.nl Abstract. Hoare triples (precondition,

More information

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell) Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 14 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 17 October 2017 1 / 21 1 Types 2 3 4 2 / 21 So far in

More information

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction Topics Chapter 3 Semantics Introduction Static Semantics Attribute Grammars Dynamic Semantics Operational Semantics Axiomatic Semantics Denotational Semantics 2 Introduction Introduction Language implementors

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions) By the end of this course, students should CIS 1.5 Course Objectives a. Understand the concept of a program (i.e., a computer following a series of instructions) b. Understand the concept of a variable

More information

Synchronization Expressions: Characterization Results and. Implementation. Kai Salomaa y Sheng Yu y. Abstract

Synchronization Expressions: Characterization Results and. Implementation. Kai Salomaa y Sheng Yu y. Abstract Synchronization Expressions: Characterization Results and Implementation Kai Salomaa y Sheng Yu y Abstract Synchronization expressions are dened as restricted regular expressions that specify synchronization

More information

Rule Formats for Nominal Modal Transition Systems

Rule Formats for Nominal Modal Transition Systems Rule Formats for Nominal Modal Transition Systems Anke Stüber Universitet Uppsala, Uppsala, Sweden anke.stuber@it.uu.se Abstract. Modal transition systems are specification languages that allow the expression

More information

Enhancing Integrated Layer Processing using Common Case. Anticipation and Data Dependence Analysis. Extended Abstract

Enhancing Integrated Layer Processing using Common Case. Anticipation and Data Dependence Analysis. Extended Abstract Enhancing Integrated Layer Processing using Common Case Anticipation and Data Dependence Analysis Extended Abstract Philippe Oechslin Computer Networking Lab Swiss Federal Institute of Technology DI-LTI

More information

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations Outline Computer Science 331 Data Structures, Abstract Data Types, and Their Implementations Mike Jacobson 1 Overview 2 ADTs as Interfaces Department of Computer Science University of Calgary Lecture #8

More information

2 Related Work Often, animation is dealt with in an ad-hoc manner, such as keeping track of line-numbers. Below, we discuss some generic approaches. T

2 Related Work Often, animation is dealt with in an ad-hoc manner, such as keeping track of line-numbers. Below, we discuss some generic approaches. T Animators for Generated Programming Environments Frank Tip? CWI, P.O. Box 4079, 1009 AB Amsterdam, The Netherlands tip@cwi.nl Abstract. Animation of execution is a necessary feature of source-level debuggers.

More information

when a process of the form if be then p else q is executed and also when an output action is performed. 1. Unnecessary substitution: Let p = c!25 c?x:

when a process of the form if be then p else q is executed and also when an output action is performed. 1. Unnecessary substitution: Let p = c!25 c?x: URL: http://www.elsevier.nl/locate/entcs/volume27.html 7 pages Towards Veried Lazy Implementation of Concurrent Value-Passing Languages (Abstract) Anna Ingolfsdottir (annai@cs.auc.dk) BRICS, Dept. of Computer

More information

Supplementary Notes on Abstract Syntax

Supplementary Notes on Abstract Syntax Supplementary Notes on Abstract Syntax 15-312: Foundations of Programming Languages Frank Pfenning Lecture 3 September 3, 2002 Grammars, as we have discussed them so far, define a formal language as a

More information

Solve the Data Flow Problem

Solve the Data Flow Problem Gaining Condence in Distributed Systems Gleb Naumovich, Lori A. Clarke, and Leon J. Osterweil University of Massachusetts, Amherst Computer Science Department University of Massachusetts Amherst, Massachusetts

More information

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 6: Polymorphic Type Systems 1. Polymorphic

More information

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-00 014 Subject: PPL Class : CSE III 1 P a g e DEPARTMENT COMPUTER SCIENCE AND ENGINEERING S No QUESTION Blooms Course taxonomy level Outcomes UNIT-I

More information

3.7 Denotational Semantics

3.7 Denotational Semantics 3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These

More information

Functional Programming Language Haskell

Functional Programming Language Haskell Functional Programming Language Haskell Mohammed Aslam CIS 24 Prof. Kopec Presentation: 03 Date: 05/05/2003 Haskell is a general purpose, purely functional programming language named after the logician

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

College Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013.

College Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013. AP Computer Science August 2014 June 2015 Class Description AP Computer Science is the second class after Pre-AP Computer Science that together teach the fundamentals of object-oriented programming and

More information

A Small Interpreted Language

A Small Interpreted Language A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

More information

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

More information

proc {Produce State Out} local State2 Out2 in State2 = State + 1 Out = State Out2 {Produce State2 Out2}

proc {Produce State Out} local State2 Out2 in State2 = State + 1 Out = State Out2 {Produce State2 Out2} Laziness and Declarative Concurrency Raphael Collet Universite Catholique de Louvain, B-1348 Louvain-la-Neuve, Belgium raph@info.ucl.ac.be May 7, 2004 Abstract Concurrency and distribution in a programming

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

LECTURE 16. Functional Programming

LECTURE 16. Functional Programming LECTURE 16 Functional Programming WHAT IS FUNCTIONAL PROGRAMMING? Functional programming defines the outputs of a program as a mathematical function of the inputs. Functional programming is a declarative

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections p.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections p. CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections 10.1-10.3 p. 1/106 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts

More information

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m. CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.

More information

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen Formal semantics of loosely typed languages Joep Verkoelen Vincent Driessen June, 2004 ii Contents 1 Introduction 3 2 Syntax 5 2.1 Formalities.............................. 5 2.2 Example language LooselyWhile.................

More information

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Massachusetts Institute of Technology Language Definition Problem How to precisely define language Layered structure

More information

Curriculum Map Grade(s): Subject: AP Computer Science

Curriculum Map Grade(s): Subject: AP Computer Science Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History

More information

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309 A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48

More information

Provably Correct Software

Provably Correct Software Provably Correct Software Max Schäfer Institute of Information Science/Academia Sinica September 17, 2007 1 / 48 The Need for Provably Correct Software BUT bugs are annoying, embarrassing, and cost gazillions

More information

Type and Eect Systems via Abstract Interpretation. Jer^ome Vouillon. Pierre Jouvelot. CRI, Ecole des Mines de Paris. Abstract

Type and Eect Systems via Abstract Interpretation. Jer^ome Vouillon. Pierre Jouvelot. CRI, Ecole des Mines de Paris. Abstract Type and Eect Systems via Abstract Interpretation Jer^ome Vouillon Pierre Jouvelot CRI, Ecole des Mines de Paris fvouillon, jouvelotg@cri.ensmp.fr July 12, 1995 Abstract Abstract interpretation and type

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

MIT Specifying Languages with Regular Expressions and Context-Free Grammars MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Language Definition Problem How to precisely

More information

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massachusetts, 2000 Among the many approaches to formal reasoning

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

What do Compilers Produce?

What do Compilers Produce? What do Compilers Produce? Pure Machine Code Compilers may generate code for a particular machine, not assuming any operating system or library routines. This is pure code because it includes nothing beyond

More information

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Brigitte Pientka and Joshua Dunfield McGill University, Montréal, Canada {bpientka,joshua}@cs.mcgill.ca Abstract.

More information

easel LANGUAGE REFERENCE MANUAL

easel LANGUAGE REFERENCE MANUAL easel LANGUAGE REFERENCE MANUAL Manager Danielle Crosswell dac2182 Language Guru Tyrus Cukavac thc2125 System Architect Yuan-Chao Chou yc3211 Tester Xiaofei Chen xc2364 Table of Contents 1. Introduction...

More information

Department of. Computer Science. Uniqueness Analysis of Array. Omega Test. October 21, Colorado State University

Department of. Computer Science. Uniqueness Analysis of Array. Omega Test. October 21, Colorado State University Department of Computer Science Uniqueness Analysis of Array Comprehensions Using the Omega Test David Garza and Wim Bohm Technical Report CS-93-127 October 21, 1993 Colorado State University Uniqueness

More information

Programming Languages, Summary CSC419; Odelia Schwartz

Programming Languages, Summary CSC419; Odelia Schwartz Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design

More information

An Eclipse-based Integrated Environment for Developing Executable Structural Operational Semantics Specifications

An Eclipse-based Integrated Environment for Developing Executable Structural Operational Semantics Specifications SOS 2006 Preliminary Version An Eclipse-based Integrated Environment for Developing Executable Structural Operational Semantics Specifications Adrian Pop 1,2 Peter Fritzson 3 Programming Environments Laboratory

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

CS 6110 S14 Lecture 1 Introduction 24 January 2014

CS 6110 S14 Lecture 1 Introduction 24 January 2014 CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

KeyNote: Trust Management for Public-Key. 180 Park Avenue. Florham Park, NJ USA.

KeyNote: Trust Management for Public-Key. 180 Park Avenue. Florham Park, NJ USA. KeyNote: Trust Management for Public-Key Infrastructures Matt Blaze 1 Joan Feigenbaum 1 Angelos D. Keromytis 2 1 AT&T Labs { Research 180 Park Avenue Florham Park, NJ 07932 USA fmab,jfg@research.att.com

More information

Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1

Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanfordedu) February 6, 2018 Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1 In the

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module

More information

Reverse Engineering with a CASE Tool. Bret Johnson. Research advisors: Spencer Rugaber and Rich LeBlanc. October 6, Abstract

Reverse Engineering with a CASE Tool. Bret Johnson. Research advisors: Spencer Rugaber and Rich LeBlanc. October 6, Abstract Reverse Engineering with a CASE Tool Bret Johnson Research advisors: Spencer Rugaber and Rich LeBlanc October 6, 994 Abstract We examine using a CASE tool, Interactive Development Environment's Software

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

The Programming Language Core

The Programming Language Core The Programming Language Core Wolfgang Schreiner Research Institute for Symbolic Computation (RISC-Linz) Johannes Kepler University, A-4040 Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

More information

An Efficient Staging Algorithm for Binding-Time Analysis

An Efficient Staging Algorithm for Binding-Time Analysis An Efficient Staging Algorithm for Binding-Time Analysis Takuma Murakami 1, Zhenjiang Hu 1,2, Kazuhiko Kakehi 1, and Masato Takeichi 1 1 Department of Mathematical Informatics, Graduate School of Information

More information

Semantics of programming languages

Semantics of programming languages Semantics of programming languages Informatics 2A: Lecture 27 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 21 November, 2011 1 / 19 1 2 3 4 2 / 19 Semantics for programming

More information

(Refer Slide Time: 4:00)

(Refer Slide Time: 4:00) Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional

More information

Chapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes

Chapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,

More information

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher COP4020 ming Languages Compilers and Interpreters Robert van Engelen & Chris Lacher Overview Common compiler and interpreter configurations Virtual machines Integrated development environments Compiler

More information

Rance Cleaveland The Concurrency Factory is an integrated toolset for specication, simulation,

Rance Cleaveland The Concurrency Factory is an integrated toolset for specication, simulation, The Concurrency Factory Software Development Environment Rance Cleaveland (rance@csc.ncsu.edu) Philip M. Lewis (pml@cs.sunysb.edu) y Scott A. Smolka (sas@cs.sunysb.edu) y Oleg Sokolsky (oleg@ccc.com) y

More information

Transport protocols are of practical. login, le transfer, and remote procedure. calls. will operate on and therefore are generally

Transport protocols are of practical. login, le transfer, and remote procedure. calls. will operate on and therefore are generally Hazard-Free Connection Release Jennifer E. Walter Department of Computer Science Texas A&M University College Station, TX 77843-3112, U.S.A. Jennifer L. Welch Department of Computer Science Texas A&M University

More information

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML)

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML) CIS24 Project #3 Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec Subject: Functional Programming Language (ML) 1 Introduction ML Programming Language Functional programming

More information

Com S 541. Programming Languages I

Com S 541. Programming Languages I Programming Languages I Lecturer: TA: Markus Lumpe Department of Computer Science 113 Atanasoff Hall http://www.cs.iastate.edu/~lumpe/coms541.html TR 12:40-2, W 5 Pramod Bhanu Rama Rao Office hours: TR

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Objective PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Explain what is meant by compiler. Explain how the compiler works. Describe various analysis of the source program. Describe the

More information

Improving the Static Analysis of Loops by Dynamic Partitioning Techniques

Improving the Static Analysis of Loops by Dynamic Partitioning Techniques Improving the Static Analysis of Loops by Dynamic Partitioning echniques Matthieu Martel CEA - Recherche echnologique LIS-DSI-SLA CEA F91191 Gif-Sur-Yvette Cedex, France Matthieu.Martel@cea.fr Abstract

More information

i=1 i=2 i=3 i=4 i=5 x(4) x(6) x(8)

i=1 i=2 i=3 i=4 i=5 x(4) x(6) x(8) Vectorization Using Reversible Data Dependences Peiyi Tang and Nianshu Gao Technical Report ANU-TR-CS-94-08 October 21, 1994 Vectorization Using Reversible Data Dependences Peiyi Tang Department of Computer

More information

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Compiler Theory. (Semantic Analysis and Run-Time Environments) Compiler Theory (Semantic Analysis and Run-Time Environments) 005 Semantic Actions A compiler must do more than recognise whether a sentence belongs to the language of a grammar it must do something useful

More information

Lambda Calculus and Type Inference

Lambda Calculus and Type Inference Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ October 13, 2004 Lambda Calculus and Type

More information

2 c LNCS To appear in PLILP'98 all le modication times in order to incrementally rebuild a system would clearly be lengthy, tedious and error-prone. S

2 c LNCS To appear in PLILP'98 all le modication times in order to incrementally rebuild a system would clearly be lengthy, tedious and error-prone. S Architecturing Software Using A Methodology for Language Development Charles Consel and Renaud Marlet IRISA / INRIA - University of Rennes 1 Campus universitaire de Beaulieu, 35042 Rennes Cedex, France

More information

Lazy State Evaluation of Process Functional Programs

Lazy State Evaluation of Process Functional Programs Lazy State Evaluation of Process Functional Programs Ján Kollár Jan.Kollar@tuke.sk Jaroslav Porubän Jaroslav.Poruban@tuke.sk Peter Václavík Peter.Vaclavik@tuke.sk Miroslav Vidiščak Miroslav.Vidiscak@tuke.sk

More information

40 Behaviour Compatibility

40 Behaviour Compatibility 40 Behaviour Compatibility [2] R. De Nicola, Extentional Equivalences for Transition Systems, Acta Informatica, vol. 24, pp. 21-237, 1987. [3] J. Gray, Notes on Data Base Operating Systems, in Operating

More information