Domain-specific language
From Wikipedia, the free encyclopedia
Programming paradigms
Action
Agent-oriented
Automata-based
Concurrent computing
Relativistic programming
Data-driven
Declarative (contrast: Imperative)
Constraint
Dataflow
Flow-based
Cell-oriented (spreadsheets)
Reactive
Functional
Functional logic
Logic
Abductive logic
Answer set
Constraint logic
Functional logic
Inductive logic
Relational
End-user programming
Event-driven
Service-oriented
Time-driven
Expression-oriented
Feature-oriented
Function-level (contrast: Value-level)
Generic
Imperative (contrast: Declarative)
Procedural
Language-oriented
Natural language programming
Discipline-specific
Domain-specific
Grammar-oriented
Dialecting
Intentional
Metaprogramming
Automatic
Reflective
Attribute-oriented
Homoiconic
Template
Policy-based
Non-structured (contrast: Structured)
Array
Nondeterministic
Parallel computing
Process-oriented
Point-free style
Concatenative
Semantic
Structured (contrast: Non-structured)
Block-structured
Modular (contrast: Monolithic)
Object-oriented (OOP)
Class-based
Prototype-based
By separation of concerns:
Aspect-oriented
Role-oriented
Subject-oriented
Recursive
Value-level (contrast: Function-level)
Probabilistic
Concept
v t e
A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains, and lacks specialized features for a particular domain. There is a wide variety of DSLs, ranging from widely used languages for common domains, such as HTML for web pages, down to languages used by only a single piece of software. DSLs can be further subdivided by the kind of language, and include domain-specific markup languages, domain-specific modeling languages (more generally, specification languages), and domain-specific programming languages. Special-purpose computer languages have always existed in the computer age, but the term "domain-specific language" has become more popular due to the rise of domain-specific modeling. Simpler DSLs, particularly ones used by a single application, are sometimes informally called mini-languages.
The line between general-purpose languages and domain-specific languages is not always sharp, as a language may have specialized features for a particular domain but be applicable more broadly, or conversely may in principle be capable of broad application but in practice used primarily for a specific domain. For example, Perl was originally developed as a text-processing and glue language, for the same domain as AWK and shell scripts, but has since become a general-purpose programming language. By contrast, PostScript is a Turing complete language, and in principle can be used for any task, but in practice is narrowly used as a page description language.
Contents [hide]
1 Use
2 Overview
2.1 In design and implementation
2.2 Programming tools
3 Domain-specific language topics
3.1 Usage patterns
3.2 Design goals
3.3 Idioms
4 Examples
4.1 Game Maker Language
4.2 Unix shell scripts
4.3 ColdFusion Markup Language
4.4 Erlang OTP
4.5 FilterMeister
4.6 MediaWiki templates
4.7 Software engineering uses
4.8 Metacompilers
4.9 Unreal Engine and other games
4.10 Rules Engines for Policy Automation
4.11 Statistical modelling languages
4.12 Generate model and services to multiple programming Languages
5 Advantages and disadvantages
6 See also
7 References
8 Further reading
9 External links
Use[edit]
The design and use of appropriate DSLs is a key part of domain engineering, by using a language suitable to the domain at hand – this may consist of using an existing DSL or GPL, or developing a new DSL. Language-Oriented Programming considers the creation of special-purpose languages for expressing problems a standard part of the problem solving process. Creating a domain-specific language (with software to support it), rather than reusing an existing language, can be worthwhile if the language allows a particular type of problem or solution to be expressed more clearly than an existing language would allow and the type of problem in question reappears sufficiently often. Pragmatically, a DSL may be specialized to a particular problem domain, a particular problem representation technique, a particular solution technique, or other aspect of a domain.
Overview[edit]
A domain-specific language is created specifically to solve problems in a particular domain and is not intended to be able to solve problems outside it (although that may be technically possible). In contrast, general-purpose languages are created to solve problems in many domains. The domain can also be a business area. Some examples of business areas include:
domain-specific language for life insurance policies developed internally in large insurance enterprise
domain-specific language for combat simulation
domain-specific language for salary calculation
domain-specific language for billing
A domain-specific language is somewhere between a tiny programming language and a scripting language, and is often used in a way analogous to a programming library. The boundaries between these concepts are quite blurry, much like the boundary between scripting languages and general-purpose languages.
In design and implementation[edit]
Domain-specific languages are languages (or often, declared syntaxes or grammars) with very specific goals in design and implementation. A domain-specific language can be one of a visual diagramming language, such as those created by the Generic Eclipse Modeling System, programmatic abstractions, such as the Eclipse Modeling Framework, or textual languages. For instance, the command line utility grep has a regular expression syntax which matches patterns in lines of text. The sed utility defines a syntax for matching and replacing regular expressions. Often, these tiny languages can be used together inside a shell to perform more complex programming tasks.
The line between domain-specific languages and scripting languages is somewhat blurred, but domain-specific languages often lack low-level functions for filesystem access, interprocess control, and other functions that characterize full-featured programming languages, scripting or otherwise. Many domain-specific languages do not compile to byte-code or executable code, but to various kinds of media objects: GraphViz exports to PostScript, GIF, JPEG, etc., where Csound compiles to audio files, and a ray-tracing domain- specific language like POV compiles to graphics files. A computer language like SQL presents an interesting case: it can be deemed a domain-specific language because it is specific to a specific domain (in SQL's case, accessing and managing relational databases), and is often called from another application, but SQL has more keywords and functions than many scripting languages, and is often thought of as a language in its own right, perhaps because of the prevalence of database manipulation in programming and the amount of mastery required to be an expert in the language.
Further blurring this line, many domain-specific languages have exposed APIs, and can be accessed from other programming languages without breaking the flow of execution or calling a separate process, and can thus operate as programming libraries.
Programming tools[edit]
Some domain-specific languages expand over time to include full-featured programming tools, which further complicates the question of whether a language is domain-specific or not. A good example is the functional language XSLT, specifically designed for transforming one XML graph into another, which has been extended since its inception to allow (particularly in its 2.0 version) for various forms of filesystem interaction, string and date manipulation, and data typing.
In model-driven engineering many examples of domain-specific languages may be found like OCL, a language for decorating models with assertions or QVT, a domain-specific transformation language. However languages like UML are typically general purpose modeling languages.
To summarize, an analogy might be useful: a Very Little Language is like a knife, which can be used in thousands of different ways, from cutting food to cutting down trees. A domain-specific language is like an electric drill: it is a powerful tool with a wide variety of uses, but a specific context, namely, putting holes in things. A General Purpose Language is a complete workbench, with a variety of tools intended for performing a variety of tasks. Domain-specific languages should be used by programmers who, looking at their current workbench, realize they need a better drill, and find that a particular domain-specific language provides exactly that.
Domain-specific language topics[edit]
Usage patterns[edit]
There are several usage patterns for domain-specific languages:[1][2]
processing with standalone tools, invoked via direct user operation, often on the command line or from a Makefile (e.g., the GraphViz tool set)
domain-specific languages which are implemented using programming language macro systems, and which are converted or expanded into a host general purpose language at compile-time or read-time
embedded (or internal) domain-specific languages, implemented as libraries which exploit the syntax of their host general purpose language or a subset thereof, while adding domain-specific language elements (data types, routines, methods, macros etc.).
domain-specific languages which are called (at runtime) from programs written in general purpose languages like C or Perl, to perform a specific function, often returning the results of operation to the "host" programming language for further processing; generally, an interpreter or virtual machine for the domain-specific language is embedded into the host application
domain-specific languages which are embedded into user applications (e.g., macro languages within spreadsheets) and which are (1) used to
Domain-specific language
From Wikipedia, the free encyclopedia
Programming paradigms
Action
Agent-oriented
Automata-based
Concurrent computing
Relativistic programming
Data-driven
Declarative (contrast: Imperative)
Constraint
Dataflow
Flow-based
Cell-oriented (spreadsheets)
Reactive
Functional
Functional logic
Logic
Abductive logic
Answer set
Constraint logic
Functional logic
Inductive logic
Relational
End-user programming
Event-driven
Service-oriented
Time-driven
Expression-oriented
Feature-oriented
Function-level (contrast: Value-level)
Generic
Imperative (contrast: Declarative)
Procedural
Language-oriented
Natural language programming
Discipline-specific
Domain-specific
Grammar-oriented
Dialecting
Intentional
Metaprogramming
Automatic
Reflective
Attribute-oriented
Homoiconic
Template
Policy-based
Non-structured (contrast: Structured)
Array
Nondeterministic
Parallel computing
Process-oriented
Point-free style
Concatenative
Semantic
Structured (contrast: Non-structured)
Block-structured
Modular (contrast: Monolithic)
Object-oriented (OOP)
Class-based
Prototype-based
By separation of concerns:
Aspect-oriented
Role-oriented
Subject-oriented
Recursive
Value-level (contrast: Function-level)
Probabilistic
Concept
v t e
A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains, and lacks specialized features for a particular domain. There is a wide variety of DSLs, ranging from widely used languages for common domains, such as HTML for web pages, down to languages used by only a single piece of software. DSLs can be further subdivided by the kind of language, and include domain-specific markup languages, domain-specific modeling languages (more generally, specification languages), and domain-specific programming languages. Special-purpose computer languages have always existed in the computer age, but the term "domain-specific language" has become more popular due to the rise of domain-specific modeling. Simpler DSLs, particularly ones used by a single application, are sometimes informally called mini-languages.
The line between general-purpose languages and domain-specific languages is not always sharp, as a language may have specialized features for a particular domain but be applicable more broadly, or conversely may in principle be capable of broad application but in practice used primarily for a specific domain. For example, Perl was originally developed as a text-processing and glue language, for the same domain as AWK and shell scripts, but has since become a general-purpose programming language. By contrast, PostScript is a Turing complete language, and in principle can be used for any task, but in practice is narrowly used as a page description language.
Contents [hide]
1 Use
2 Overview
2.1 In design and implementation
2.2 Programming tools
3 Domain-specific language topics
3.1 Usage patterns
3.2 Design goals
3.3 Idioms
4 Examples
4.1 Game Maker Language
4.2 Unix shell scripts
4.3 ColdFusion Markup Language
4.4 Erlang OTP
4.5 FilterMeister
4.6 MediaWiki templates
4.7 Software engineering uses
4.8 Metacompilers
4.9 Unreal Engine and other games
4.10 Rules Engines for Policy Automation
4.11 Statistical modelling languages
4.12 Generate model and services to multiple programming Languages
5 Advantages and disadvantages
6 See also
7 References
8 Further reading
9 External links
Use[edit]
The design and use of appropriate DSLs is a key part of domain engineering, by using a language suitable to the domain at hand – this may consist of using an existing DSL or GPL, or developing a new DSL. Language-Oriented Programming considers the creation of special-purpose languages for expressing problems a standard part of the problem solving process. Creating a domain-specific language (with software to support it), rather than reusing an existing language, can be worthwhile if the language allows a particular type of problem or solution to be expressed more clearly than an existing language would allow and the type of problem in question reappears sufficiently often. Pragmatically, a DSL may be specialized to a particular problem domain, a particular problem representation technique, a particular solution technique, or other aspect of a domain.
Overview[edit]
A domain-specific language is created specifically to solve problems in a particular domain and is not intended to be able to solve problems outside it (although that may be technically possible). In contrast, general-purpose languages are created to solve problems in many domains. The domain can also be a business area. Some examples of business areas include:
domain-specific language for life insurance policies developed internally in large insurance enterprise
domain-specific language for combat simulation
domain-specific language for salary calculation
domain-specific language for billing
A domain-specific language is somewhere between a tiny programming language and a scripting language, and is often used in a way analogous to a programming library. The boundaries between these concepts are quite blurry, much like the boundary between scripting languages and general-purpose languages.
In design and implementation[edit]
Domain-specific languages are languages (or often, declared syntaxes or grammars) with very specific goals in design and implementation. A domain-specific language can be one of a visual diagramming language, such as those created by the Generic Eclipse Modeling System, programmatic abstractions, such as the Eclipse Modeling Framework, or textual languages. For instance, the command line utility grep has a regular expression syntax which matches patterns in lines of text. The sed utility defines a syntax for matching and replacing regular expressions. Often, these tiny languages can be used together inside a shell to perform more complex programming tasks.
The line between domain-specific languages and scripting languages is somewhat blurred, but domain-specific languages often lack low-level functions for filesystem access, interprocess control, and other functions that characterize full-featured programming languages, scripting or otherwise. Many domain-specific languages do not compile to byte-code or executable code, but to various kinds of media objects: GraphViz exports to PostScript, GIF, JPEG, etc., where Csound compiles to audio files, and a ray-tracing domain- specific language like POV compiles to graphics files. A computer language like SQL presents an interesting case: it can be deemed a domain-specific language because it is specific to a specific domain (in SQL's case, accessing and managing relational databases), and is often called from another application, but SQL has more keywords and functions than many scripting languages, and is often thought of as a language in its own right, perhaps because of the prevalence of database manipulation in programming and the amount of mastery required to be an expert in the language.
Further blurring this line, many domain-specific languages have exposed APIs, and can be accessed from other programming languages without breaking the flow of execution or calling a separate process, and can thus operate as programming libraries.
Programming tools[edit]
Some domain-specific languages expand over time to include full-featured programming tools, which further complicates the question of whether a language is domain-specific or not. A good example is the functional language XSLT, specifically designed for transforming one XML graph into another, which has been extended since its inception to allow (particularly in its 2.0 version) for various forms of filesystem interaction, string and date manipulation, and data typing.
In model-driven engineering many examples of domain-specific languages may be found like OCL, a language for decorating models with assertions or QVT, a domain-specific transformation language. However languages like UML are typically general purpose modeling languages.
To summarize, an analogy might be useful: a Very Little Language is like a knife, which can be used in thousands of different ways, from cutting food to cutting down trees. A domain-specific language is like an electric drill: it is a powerful tool with a wide variety of uses, but a specific context, namely, putting holes in things. A General Purpose Language is a complete workbench, with a variety of tools intended for performing a variety of tasks. Domain-specific languages should be used by programmers who, looking at their current workbench, realize they need a better drill, and find that a particular domain-specific language provides exactly that.
Domain-specific language topics[edit]
Usage patterns[edit]
There are several usage patterns for domain-specific languages:[1][2]
processing with standalone tools, invoked via direct user operation, often on the command line or from a Makefile (e.g., the GraphViz tool set)
domain-specific languages which are implemented using programming language macro systems, and which are converted or expanded into a host general purpose language at compile-time or read-time
embedded (or internal) domain-specific languages, implemented as libraries which exploit the syntax of their host general purpose language or a subset thereof, while adding domain-specific language elements (data types, routines, methods, macros etc.).
domain-specific languages which are called (at runtime) from programs written in general purpose languages like C or Perl, to perform a specific function, often returning the results of operation to the "host" programming language for further processing; generally, an interpreter or virtual machine for the domain-specific language is embedded into the host application
domain-specific languages which are embedded into user applications (e.g., macro languages within spreadsheets) and which are (1) used to
การแปล กรุณารอสักครู่..
