Clever Geek Handbook
📜 ⬆️ ⬇️

Subject oriented language

Domain-specific language ( English domain-specific language , DSL - " domain-specific language ") - a programming language , specialized for a specific application (as opposed , applicable to a wide range of areas and not taking into account the features of specific areas of knowledge). The construction of such a language and / or its data structure reflect the specifics of the tasks solved with its help [1] . It is a key concept in language-oriented programming .

Strictly speaking, the division of programming languages ​​into general-purpose and subject-oriented languages ​​is very arbitrary, especially when you consider that formally any protocol or file format is a language . There are many general-purpose languages ​​used as subject-oriented for certain tasks, and vice versa, subject-oriented languages ​​used as general-purpose languages. So, the ML language , which spawned a whole family of general-purpose languages ​​(including Haskell ), was originally developed as a DSL for the theorem automatic proof . The BPF language (and the compiler Lex / Yacc from it) is an example showing the classification classification: on the one hand, this is a vivid example of a metalanguage , on the other hand, it is intended for one specific task.

Content

Terminology

The simplest domain-specific languages ​​used in one particular application are often called “mini-languages” [2] .

Martin Ward [3], in his Language Oriented Programming [4] (which is considered the starting point for the development of NOP ), used the terms “ problem oriented ” and “ domain oriented, ” but in the English-speaking scientific community, the term “ domain-specific ”, moreover,“ domain-specific language ”, and not“ domain-specific programming language ”. In the Russian-language literature on programming, there are variants of “ domain-specific ”, “ problem-oriented ”, “ subject-oriented ”.

Fowler [5] and Dmitriev [6] define the concept of DSL as "a stripped down programming language (in most cases incomplete by Turing ) ."

Examples

Leading researchers of language-oriented programming (Martin Ward, , Walid Taha and others) give the following examples of subject-specific languages ​​as classical [4] [7] [8] :

  • TeX / LaTeX for the preparation ( computer layout ) of text documents;
  • Perl for text manipulation;
  • SQL for DBMS ;
  • Tcl / Tk for the graphical user interface ;
  • HTML and SGML for marking up documents;
  • Verilog and VHDL for hardware description;
  • Mathematica and Maple for symbolic computing;
  • AutoLisp for computer simulation ( CAD );
  • Prolog for tasks formulated in terms of predicate calculus ;
  • ML and Haskell for tasks formulated in terms of functions ( Haskell is sometimes defined as DSL for ).

According to Valid Tahi, from the point of view of NOP Microsoft Excel is perhaps the most widely used programming language in the world [8] .

Other examples of domain-specific languages ​​are database management languages ​​(in addition to SQL , for example, the FoxPro language), command languages ​​of operating systems (languages ​​of an interactive command shell, primarily Unix Shell , batch job languages ​​such as JCL , etc. .) [9] , Turing's incomplete data structuring languages ​​( XML , .ini , .conf), wiki markup language , modeling languages ​​( UML , GPSS ), Erlang for multi-user servers operating in uninterrupted mode.

There are programming languages ​​built into the enterprise resource management system (ABAP language in SAP / R3, languages ​​of the Galaxy, Parus, 1C, Info-Accountant systems) and the modules used to complement them specific to a specific organization. Using the built-in language simplifies the programming of specific tasks, since the language initially contains concepts of the subject area. Some [ what? ] geographic information systems and CAD also have built-in programming languages.

Other examples:

  • G-code - programming language of devices with numerical program control (CNC);
  • NMB .

Embedded Languages

At times, computer languages ​​are implemented in a dependent way, that is, "inside" the translated language, without which these languages ​​are not only unable to be executed, but often do not form an integral symbolic system and do not have Turing completeness . Such languages ​​are called “ embedded subject-specific languages ” ( English embedded DSL , EDSL ; sometimes DSEL ) or simply “ embedded languages ” [7] [10] , as well as “languages ​​implemented on top of or based on this language ".

Text Languages

In addition to the traditional division of languages ​​into interpreted and compiled , embedded languages ​​introduce several more types of language implementations:

  • clean embed [7] ;
  • the use of macro language tools (and often their identification with the term " metaprogramming "), which, in turn, is divided into [11] :
    • multistage computations ;
    • quasicitation (known from the Lisp language );
    • use of patterns .

On the other hand, it is possible to consider the implementation of an embedded language as “implementation without translation ”, implying that DSL will be a syntactic and semantic subset of the language into which it is embedded [11] .

The language used as the base for the implementation of another is often called a metalanguage .

There are three main reasons for developing embedded text languages:

  • introducing additional features into the source language that expand the range of effectively solved problems or syntactically simplify the solution of frequently encountered problems;
  • intensive reuse of components of the translator of the base language: the parser , the typing mechanism, the implementation of trivial things (such as arithmetic of numbers), the optimizer, etc. This provides a multiple reduction in the complexity of the implementation of the invented language, as well as a high level of implementation quality when using a safe language as the base;
  • obtaining the ability to effectively mix the properties of different independent languages ​​in single code fragments, forming a multi-paradigm wide-profile language , eliminating the need for and expanding optimization capabilities.

The most common examples of the languages ​​of the first group are the implementation of object-oriented capabilities in functional [12] or procedural [13] languages, and the CLOS language is a classic example. It should be noted that the term “language” is not always used here - at times they simply talk about “ implementing new features in the language ” or “ expanding the language with a subsystem aimed at solving certain problems ”, and there is no strict division into “ libraries ” and “embedded languages ”, Since formally any API , protocol or data structure can be considered as a language [14] . So, for example, an integral part of the Lisp language is the built-in, not Turing-complete S-expression language .

The second group of embedded languages ​​is most fully represented in the Haskell language community, and therefore, Haskell itself is sometimes defined as “ DSL for denotational semantics ” [7] . Examples include Elm and other languages ​​representing the functional reactive paradigm , as well as the Curry language. At times, there is also a similar expression regarding Lisp : “ Lisp is not a language, but an environment for developing languages .” An example of a language implemented on top of Lisp is . A lot of embedded mini-languages ​​are implemented in the OCaml language through the module of the compiler. The Rebol language has also been designed for programming through the intensive implementation of embedded mini-languages. In the Lisp dialect Scheme , the language language, embodying the XML protocol in an embeddable manner.

An embedded language can have self-sufficient Turing-complete semantics, but nevertheless, instead of an independent implementation, reuse the components of the base language (third group, mixing the first two). A striking example is the Schelog language [15] , which implements the Prolog semantics within the Lisp dialect of Scheme by means of continuations , and turns the Prolog from an “independent” language into an embedded language. The traditional educational or “sporting” task for many functional languages is to implement, on top of the language in question, some other, most often the language of first-order predicate logic [16] .

In the context of metalanguages, independent languages ​​are sometimes called “first-class languages” (by analogy with first-class entities in languages), and embedded languages ​​are called “object languages”.

In the vast majority of cases, embedded languages ​​have only one supported implementation, and the differences in the resulting machine representation of the code on them depend only on the translator of the base language used. However, there are exceptions - for example, the Concurrent ML (CML) language, which extends Standard ML with constructions for explicit parallelism , has two fundamentally different implementations.

Visual Languages

One of the languages ​​(basic or embedded) can be visual , which is often used in ( English end-user development ). Typical examples of such pairs are AutoLisp - AutoCAD and VBA - Microsoft Excel . Such pairs form an integrated interactive system, and from the point of view of the user it is impossible (and not necessary) to determine whether visual tools are an add-on that imitates commands of an embedded text language, or whether the text language controls visual tools. The actual relationships in these pairs are determined by the developer.

In the Emacs - Emacs Lisp pair, relationships are more defined. Lisp traditionally refers to metalanguages , and in this case, the text editor is built on top of it as a visual DSL, which makes the latter mutable and extensible.

In the case when both languages ​​are visual, embedded languages ​​are usually called by other terms - plugins , filters, etc., and do not use the terminology of language-oriented programming. Formally , we can say, for example, that for the visual meta-language for processing Adobe Photoshop graphics, there are many built-in visual mini-languages ​​(see ).

Functional and logical programming languages ​​look unnatural in a visual environment, since functional programming and logical programming in their pure form prohibit side effects, and for interacting with the GUI ; their conceptual integrity has to be violated. From a pedagogical point of view, it is considered desirable to teach programming using console tools in order to focus students on the basics of algorithmization, rather than ergonomics and, especially, non-procedural skills of using various IDEs [17] .

Advantages and disadvantages

The advantages and disadvantages of using a specific DSL in place of a general purpose language in a specific problem are much more clearly defined than the advantages and disadvantages of using one general purpose language instead of another: in most cases, the already developed DSL turns out to be conceptually inapplicable to one task and gives indisputable gains in most quality indicators in others, and some subtasks generally remain unresolved until the development of DSL [4] .

Thus, the question of the advantages and disadvantages is more correctly posed in the light of the use of a language-oriented methodology instead of any other in the initial absence of a finished DSL, comparing the potential gain from its use with the costs of its development and maintenance.

See also

  • Language Oriented Programming
  • Generative Programming

Notes

  1. ↑ A. Ya. Fridland, L. S. Chanamirova. Informatics and computer technology: basic terms: explanatory dictionary. - Astrel, 2003.01.01. - 270 p. - ISBN 9785170145461 .
  2. ↑ Bentley - Little languages, 1986 .
  3. ↑ Martin Ward's Homepage
  4. ↑ 1 2 3 Ward - Language Oriented Programming, 1994 .
  5. ↑ Martin Fowler . Language toolkit: a new life of subject languages . - 2005.
  6. ↑ Sergey Dmitriev ( JetBrains ). Language-oriented programming: the following paradigm // = RSDN Magazine . - 2005.
  7. ↑ 1 2 3 4 Hudak - Modular Domain Specification with Languages ​​and Tools, 1998 .
  8. ↑ 1 2 Taha - Domain-Specification of Languages, 2008 .
  9. ↑ Brett D. Hirsch. Digital Humanities Pedagogy: Practices, Principles and Politics . - Open Book Publishers, 2012 .-- 450 p. - ISBN 9781909254251 .
  10. ↑ Mernik, 2012 .
  11. ↑ 1 2 Czarnecki, O'Donnell, Striegnitz, Taha - DSL implementation in metaocaml, template haskell, and C ++, 2004 .
  12. ↑ Bernard Berthomieu. OO Programming Styles in ML . - LAAS Report # 2000111, Center National De La Recherche Scientifique Laboratoire d'Analyse et d'Architecture des Systèmes, 2000.
  13. ↑ Cello - library that introduces higher level programming to C
  14. ↑ Hopcroft, Motwani, Ullman - Theory of Automata, Languages, and Computing, 2001 .
  15. ↑ Schelog, 2003 .
  16. ↑ Paulson - ML for the Working Programmer, 1996 .
  17. ↑ Igor Golovin, Andrey Stolyarov. Multiparadigm approach to teaching programming and the role of free software // Lomonosov Moscow State University, Abstracts of the II conference of free software developers "On Protva". - city of Obninsk, 2005.

Literature

  • Martin Ward . Language Oriented Programming . - Computer Science Department, Science Labs, 1994.
  • Paul Hudak. Modular Domain Specification with Languages ​​and Tools . - IEEE Computer Society Press, Department of Computer Science, Yale University, 1998. Archived October 17, 2013.
  • Jon Bentley Little languages . - CACM, 29 (8): 711-721, 1986.
  • Walid Taha . Domain-Speci fi c Languages . - Department of Computer Science, Rice University, 2008. Archived October 24, 2013.
  • Marjan Mernik. Formal and Practical Aspects of Domain-Specific Languages . - IGI Global, 2012 .-- ISBN 978-1-4666-2092-6 .
  • John Hopcroft, Rajeev Motwani, Jeffrey Ullman. Introduction to the theory of automata, languages, and computing. - 2nd. - Cornell University, Stanford University: Addison-Wesley Publishing Company, Williams Publishing House, 2001. - 528 p. - ISBN 5-8459-0261-4 (Russian), 0-201-44124-1 (English).
  • Lawrence C. Paulson. ML for the Working Programmer. - 2nd. - Cambridge, Great Britain: Cambridge University Press, 1996 .-- 492 p. - ISBN 0-521-57050-6 (hard cover), 0-521-56543-X (soft cover).
  • K. Czarnecki, J. O'Donnell, J. Striegnitz, W. Taha. DSL implementation in metaocaml, template haskell, and C ++ . - University of Waterloo, University of Glasgow, Research Center Julich, Rice University, 2004. Archived March 5, 2016.

Links

  • Dorai Sitaram. Programming in Schelog ( Neopr .) (2003).
  • Compilers and interpreters implemented in Haskell (neopr.) .
  • Stumbling Blocks For Domain Specific Languages (Neopr.) .
Source - https://ru.wikipedia.org/w/index.php?title=Language-oriented_Language&oldid=100117214


More articles:

  • Chalbash, Rustem Memetovich
  • Hyenictitheria
  • Chernyshev, Aristarkh Aleksandrovich
  • Poetry Square (Kharkov)
  • Ruapehu
  • NOX3
  • Bamingi-Bangoran
  • Air Motor
  • Lem, Ivan Mikhailovich
  • Sangay (volcano)

All articles

Clever Geek | 2019