oscar@cui.unige.ch (NIERSTRASZ Oscar) (11/04/88)
Does anyone know of the existence of a "pattern language" that offers the possibility of defining or extending programming languages through the definition of patterns? What I am thinking of is something more powerful than a macro pre-processor but not as general as yacc and lex. The idea is to define a set of syntactic patterns and their translations, and to then be able to program either using the patterns alone, or to use the patterns as an extension of an existing language. The closest examples I can think of are not general tools, but the possibility to extend languages through overloading etc. Smalltalk, Prolog and Lisp all make it relatively easy to add new syntactic patterns (within certain constraints!). The two main reasons I would like to have such a tool are: 1. To prototype new programming languages (or language constructs). Since the development of a new programming language and its compiler is a significant effort, it would be nice to have some tools for doing a mock-up that can be easily changed. A common trick is to implement the compiler as a translator to an existing high-level language like C, thus piggybacking on an existing compiler. A pattern language would be ideally suited to such translation. 2. To provide programmer definable language extensions (for enhancing software reusability). Programming languages suffer from the problem that the language design must "freeze" the language, pretending to anticipate the needs of all future programmers. Programming constructs basically define the ways in which reusable software can be packaged. If I discover I need generic procedures or object classes etc., but the language doesn't provide them, then I'm stuck. A pattern language would allow a programming language to remain open-ended. Examples of what you should be able to do include: - macro substitution - expression re-writing (e.g., translation to postfix form) - object classes (declaration, inheritance, ...) - control abstractions (e.g., loops, transactions, ...) - generic functions Since a pattern language should be a relatively simple tool (in the spirit of, say, awk), it should not be concerned with generation of addresses, optimization, or most of the nasty things real compilers do. The kind of functionality I believe a pattern language should provide would be: - definition of parameterized patterns and their semantic actions - actions should include bookkeeping (management of scopes and symbol tables) and generation of output (translation) - a primitive form of type-checking for pattern parameters (i.e., parameters will also be matched by patterns) - recursive patterns I would like to hear of any tools or languages that offer similar functionality, and any reactions as to the feasibility or advisability of such an animal. Oscar Nierstrasz C.U.I., University of Geneva, Switzerland E-mail: oscar@cgeuge51.bitnet oscar@cui.unige.ch oscar@cui.uucp [Fifteen years ago, there was IMP-72 which allowed you to put BNF in the program that extended the language's syntax. Since it parsed with Earley's algorithm, ambiguous syntax was OK. It worked, and you could indeed add marvelous new syntax. It failed for three reasons that I could see: Each program was, in effect, written in a new language, making maintenance nearly impossible. The underlying compiler had a rather simple idea of what was going on, making it impossible to add semantically interesting new stuff. And, finally, Earley is an N^3 algorithm, which made the compiler so slow that it was painful to use. -John] -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request
steve@hubcap.UUCP ("Steve" Stevenson) (11/08/88)
> > .... extending languages through patterns .... There was some work done in the early 70s on extensible languages. The one I remember most was Ben Wegbreit's E(xtensible) L(anguage) I. There was some play in the literature, but I think that the performance was poor. I don't have any personal experiences myself. -- Steve (really "D. E.") Stevenson steve@hubcap.clemson.edu Department of Computer Science, (803)656-5880.mabell Clemson University, Clemson, SC 29634-1906 -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request
skh@hpclskh.HP.COM (11/09/88)
For "prototype" languages, you might check the following (which I have not yet read): "The Realizable Benefits of a Langauge Prototyping Language" R.M. Herndon & Valdis A Berzins IEEE Transactions on Software Engineering, Vol.14,No.6,ppp. 803-809 June, 1988 There are languages which provide "language modules" to extend syntax in a fixed way. As to the idea of user-extendable languages...I think your comment about maintenance is the most pertinent. It's a nightmare for real applications. I would, however, be interested in any info you receive (e-mail addr. below) Stewart Hill skh%hpclskh@hplabs.hp.com
compilers-sender@ima.ima.isc.com (11/14/88)
In article <2866@ima.ima.isc.com> oscar@cui.unige.ch (NIERSTRASZ Oscar) writes: >Does anyone know of the existence of a "pattern language" ... SNOBOL is an earliest example of such a language. ICON, developed more recently by Griswald and Co. at University of Arizona is another example of a language which allows pattern matching, and various other assorted features: generators, co-expressions etc. -- Vinod [This question has provoked the most interesting set of responses in ages. I still don't really know what a pattern language is, and seeing the variety of responses that have arrived, it doesn't look like anyone else does, either. Keep those cards and letters coming, though. -John] [From harvard!ucbvax.Berkeley.EDU!decvax!tl-vaxa!grover (Vinod Grover)] -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request