GED(ID:6625/ged001)third generation of the G languages Related languages
References: DOI Extract: Illustrating Diverse Paradigms In a Multiparadigm Language Illustrating Diverse Paradigms In a Multiparadigm Language The remainder of this paper illustrates how a number of diverse programming paradigms are expressed in a working multiparadigm language called GED. A brief overview of the basic features of GED is first given and then several examples of programming in GED are presented. The examples offered demonstrate how to utilize GED in the imperative-procedural, object-oriented, functional, and logic paradigms. A description of these paradigms can be found in [l]. In addition to this, a short example is offered that blends attributes from different paradigms illustrating that diverse paradigmatic elements can be used in concert to produce concise and natural solutions to problems. GED evolved from the experimental language G-2 which was designed to explore the syntactic, semantic and implementation issues encountered when diverse programming paradigms are combined within a single linguistic framework. The language G-2 and its predecessor G have been discussed in detail elsewhere. GED directly supports many of the elements of the functional, object-oriented, procedural-imperative, relational and logic paradigms. GED is an expression-based, interpreted language that provides automatic memory management and that has an underlying object-oriented structure. The UNIX tools yacc and lex are used to generate the parser and lexical analyzer for the GED interpreter while the run-time system of GED is written in C++ and consists of about 5000 lines of code. The list is the fundamental datatype of GED and it is used as the root of the built-in class hierarchy that forms the basic structure of GED. This hierarchy along with some examples of literal values of different types is shown in Figure 1. Since the type List forms the root of the GED type hierarchy, all expressions in GED return list values. With the exception of type File, all of the built-in types below the root type List are scalar types that simply represent single, atomic values. In GED a scalar value is thought of simply as a special case of a general list value. User-defined data types may be added to the type hierarchy of GED at any point below the root type List. Such user-defined types represent full abstract data types that support inheritance of functionality and structure. The standard arithmetic, comparison, and logical operations are also provided as built-in operators in GED. These operators work as vector operations on composite list values. In addition to these operators, aggregate operators, list processing operators and a powerful set of string processing operations are provided as built-in facilities of GED. Finally it is important to note that GED treats relations, functions, objects, and composite lists as first class values of the language. All of the paradigms represented in GED are unified by the underlying list semantics of the language. For example, iterative constructs (so common to the imperative paradigm) are merely list constructors, functions are parameterized list values, relations are lists with attached constraints, and objects are environments in which special functions may be defined. This simplifies pedagogy by allowing the meaning of all GED constructs to be understood, when necessary, as part of the unifying list semantics of the language. Focusing on this underlying simplicity would even allow GED to be used as a first programming language; it would allow students to be introduced to the basic ideas embodied in relations, functions, and objects and it would help students to experience how these ideas can be applied to basic problem solving on a computer. In addition to this, the analysis of the complexity of GED programs is simplified by allowing the analysis of diverse programming techniques in GED to be based on the underlying list semantics of the language. On the other hand, in solving problems one need not be hindered by list semantics but may simply focus on an appropriate paradigm when composing solutions to problems. This last point is demonstrated in the following examples. in [ACM] Proceedings of the 1993 ACM Conference on Computer Science March 1993 view details multiparadigm language GED to teach our principles of programming languages course. The benefits of using a multiparadigm language include less time spent on learning new environments for different languages, easier transition to different paradigms, and opportunities for multiparadigm programming. In this paper, we give a brief description of GED (which supports the imperative, functional, logic, and object-oriented paradigms), describe how it is used in our course, and discuss the advantages and disadvantages of this approach versus the traditional use of several languages. Extract: Description of GED Description of GED We use the multiparadigm language GED that was developed by John Placer and is an extension of his previous languages G and G-2 [2,3]. GED is an expression-based, interpreted language that has constructs to support programming in the imperative, functional, logic and objectoriented paradigms. The basic data type in GED is a list where list members may be heterogeneous. Eight types are supported: List, Func (for function definition), Symbol, Real, Type, String, and File. The type system is hierarchically organized with List as the base type for all others. GED statements may be entered at the interpreter prompt or may be saved in a file and included in a GED session. GED has built-in operators for arithmetic, comparison, logic, list-processing, and string-processing operations. Several types of control structures are supported, including blocks for sequencing and scoping, selection statements, and iteration (while, foreach, recursion). Formatted input and output are supported for both standard input/output and files. Process abstraction is provided in GED by support for defining named entities (usually called ?functions?) for use as procedures, true functions, named logical rules, and methods. Named entities are first-class values and can, therefore, be used as arguments to other entities, returned by other entities, assigned to variables, and used as list elements. GED supports relations and has mechanisms to perform simple and complex queries on the values of relation sets. Data abstraction is provided through support for user-defined types that allow for encapsulation and inheritance. in [ACM] Proceedings of the 1993 ACM Conference on Computer Science March 1993 view details |