Special Purpose Languages (cont.) � 5. Special Purpose Languages � n Usually, special purpose languages require more intelligence in compiler/interpreter and run-time n The languages we have looked at so far, as well as the system and one reason why some of these languages paradigms on which they are based, are intended as never were successful among the target audience general purpose languages, i.e. we expect that every were bad compilers/interpreters and run-time programming task can be done using the languages � systems that essentially threw away any advantages n There are languages that were developed with a of the languages � special purpose in mind (also called domain specific n In this sense, Haskell or PROLOG come near to languages) � special purpose languages, although they were n Some of these languages later were extended to Turing-complete from the beginning � become general purpose languages and usually this n But special purposes definitely will also in future was done using one of the paradigms we looked at � drive development of programming languages � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger Examples � Examples (cont.) � n Text processing/display: � n Statistics � ● TeX, LaTeX � ● R � ● HTML � ● SPSS � n Data base creation/interaction � n Hardware description languages � ● SQL � ● Verilog � n Education/teaching � ● VHDL � n Computer games � ● Pascal, Modula � n Symbolic Math � ● Maya � ● Mathematica � ● Unreal Engine � ● Matlab � n Spreadsheets � ● Excel � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages � Jörg Denzinger Examples (cont.) � Special purpose language vs library � n Languages for multi-agent systems � ● Jade � n Library “extends” already existing language and ● netlogo � therefore requires being able to program in that n Languages for embedded systems � language � special purpose language can be easier to program in � ● Usually company-specific (and kept as private as n Special purpose language might be too specific for a possible) � particular user application � n Systems for programming by demonstration/ library is easier changed than language � examples � n Special purpose language only defines what see the following � “intelligence” need to be realized and different implementations are possible � library is its own implementation � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger 1
Special purpose language vs library 5.1 Some history: � (cont.) � Special treatment of arrays: APL � n Arrays and especially matrixes are the basis of many n Security: special purpose language run-time system mathematical and engineering programs and a code can be hidden � language that offers a lot of special treatment for library usually has to be open � them should be of quite some interest � n APL (A Programming Language) was developed in the mid-1960s at IBM as a special purpose language for exactly this (although it could be used as general purpose language also) � n It included a large collection of operators on matrixes, but due to this APL programs were difficult to read and required in the beginning special terminals to write them on � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger Some history: � Some history: � Text processing and SNOBOL (I) � Text processing and SNOBOL (II) � n Manipulation of strings is an important task for text n String pattern matching is a more complex problem editors (and Natural Language Processing) � than "normal" pattern matching and consequently the resulting implementations of SNOBOL had serious n While general purpose languages can do all performance issues � necessary manipulations, it can require rather n Operations that were "natural" in SNOBOL were complex procedures to implement some of these manipulations � finding certain substrings, testing that a word was a beginning word of a sentence or an end word and so n SNOBOL was designed already incorporating a lot of on � these manipulations as build-in operators and it contained the concept of string pattern matching n The Unix awk command can be seen as a successor of (which is pattern matching with the build-in SNOBOL, as can be more modern scripting knowledge about strings) � languages � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger 5.2 End user programming � Programming by demonstration (I) � Goal: enable end users to create their own custom n User = programmer � command sequences on a computer � è programming needs to be easier than in general � purpose languages � � n User provides expected program behavior by Classification of solutions: � demonstrating what should be done for one or n Preferences � several examples � n Scripting languages � n Compiler becomes a learner that creates out of n Macro recorders � examples a more or less abstracted representation n Programming by demonstration/examples � that the run-time system uses to execute “program” � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger 2
Programming by demonstration (II) � Programming by demonstration (III) � n Representing data: � n Accessing and manipulating data: � ● Usually rather limited data types � ● Data manipulation limited to what user interaction allows for � ● Need to represent user interactions � ● Very limited concept of variables � ● If needed, specialized data structures to represent (intermediate) results of learning process � n Structuring programs � n Control constructs: � ● Not by user but by learner � ● Usually conditional branching at best � n Executing programs � ● Loops build into program execution � ● Run-time system interprets result of learning process � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger Programming by demonstration (IV) � Examples � n Error and exception handling � n Teaching robots by � ● Usually not well supported � ● Presenting gestures � ● Would require user to demonstrate what does not ● Presenting movements � work (barely) � ● Presenting social behavior � n In- and output � ➔ Performing tasks � ● Mostly about storing learned programs � n Recurring text transformations � ● But also dependent on application � ● SmartEDIT � n Shell scripts for recurring tasks � n … � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger 5.2.1. Learning gestures for touch- screen applications � Basic ideas/General scheme � de Souza Alcantara, T. ; Denzinger, J. ; Ferreia, J. ; n Interface developer provides examples for gesture to Maurer, F.: � learn � Learning gestures for interacting with low-fidelity n System (IGT: Intelligent Gesture Toolkit) transforms prototypes , � each example into internal representation in GDL Proc. RAISE 2012, Zürich, 2012, pp. 32-36. � (Gesture Definition Language) � � n IGT creates internal representation (including Purpose: � variables) that has each example as instance (including mathematical expressions over variables) � Helping with rapid prototyping of touch screen è anti-unification modulo limited arithmetics � applications by enabling acceptance testing of gestures in interfaces � � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger � 3
Representing data � n Extends GDL for representing gestures with variables and numerical expressions � n GDL provides set of primitive conditions to define gestures � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger Control and data manipulation � n Current gesture only manipulated by providing new example or restarting � n New example is expressed in GDL � n Current gesture description and new example description are anti-unified to create new gesture description (approximated) � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger Structuring and executing programs � Exception handling � n IGT is used within low-fidelity prototype system n If new example is too different � (AST) which can use several gestures � (less than 20% of primitives match any of the previous examples) � n Gesture recognition via IGT consists in matching IGT system asks user if this is really intended � gesture(s) with currently performed gesture and performing operation associated with detected gesture. � CPSC 449 Principles of Programming Languages Jörg Denzinger CPSC 449 Principles of Programming Languages Jörg Denzinger 4
Recommend
More recommend