Programing

도메인 특정 언어는 무엇입니까?

lottogame 2020. 8. 21. 08:24
반응형

도메인 특정 언어는 무엇입니까? 사용하는 사람 있나요? 그리고 어떤 방식으로?


나는 어떤 종류의 인트로를 찾고 있고 누군가 그것을 사용했는지 확인하고 있다고 생각합니다. 사용하면 특별한 이점이 있습니까?

Wikipedia :

DSL (도메인 특정 언어) 은 특정 문제 도메인, 특정 문제 표현 기술 및 / 또는 특정 솔루션 기술 전용 프로그래밍 언어 또는 사양 언어입니다.

아무도 당신이 그것을 어떻게 구현했는지 또는 주어진 시나리오에서 어떻게 유용 할 수 있는지에 대한 구체적인 예를 줄 수 있습니까?


도메인 특정 언어는 특정 도메인 또는 일련의 문제를 처리하기 위해 작성된 언어입니다. 소프트웨어 빌드를 설명하기위한 make, ant, rake, 언어 생성을위한 lexx 및 yacc와 같은 많은 것들이 있습니다. 최근 몇 년 동안 더 쉽게 만들 수 있도록 결합되어 인기를 얻었습니다. 그중 가장 큰 것은 새로운 DSL을 쉽게 구축 할 수있는 몇 가지 기능이있는 Ruby의 인기 증가입니다.

Martin Fowler는 여기 에서와 같이이 아이디어의 큰 지지자입니다 .


DSL은보다 일반적인 프로그래밍 언어로 작성된 함수에 대한 지나치게 복잡한 인수로 생각할 수 있습니다. 실제 프로그래밍 언어가 DSL 코드를 분석하고 그것으로 무언가를, 일반적으로 DSL 코드에만 초점을 맞추고 어떤 아웃 당신이 원하는, 그리고 더 큰 시스템의 수치 방법 .

DSL의 예로는 모든 쿼리 언어 (SQL, XPath, ...), 모든 템플릿 언어 (Django, Smarty, ...), 셸 스크립트 (특히 twill과 같은 것 포함), 명령 기반 웹 브라우저 (주로 자동화 테스트에 사용됨)가 있습니다. ), 데이터 저장 및 교환 언어 (XML, YAML, ...), LaTex, HTML 또는 CSS와 같은 문서 언어.

TCL 및 Lisp와 같은 매우 유연한 구문을 가진 일부 언어는 가능한 경우 DSL을 해당 언어로 직접 빌드합니다. 대부분의 언어는 일반적으로 외부 파일에서로드되는 문자열을 사용합니다.

그것들을 사용하면 특별한 이점이 있습니까? 그것들을 의도 된 목적으로 사용하는 것은 당신이 그들을 DSL로 생각하지 않고 SQL이나 HTML을 사용했던 것처럼 (내 생각에) 모르는 사이에 그것들을 사용할 수 있다는 점에서 매우 유리합니다.

나는 당신이 필요로 할 수있는 어떤 종류의 애플리케이션에도 충분한 DSL이 있다고 감히 말할 것이다. 당신은 거의 확실히 당신 자신의 것을 작성하는 방법을 배울 필요가 없습니다.


(질문의 핵심을 다룬다)

어딘가 에서 DSL 과 그 정의를 "도메인 특정 언어"로 처음 보았을 때 저는 DSL 이 내가 방금 들어 본 적이없는 구체적이고 구체적인 언어라고 생각했습니다. 그러나 그렇지 않습니다. 특정 응용 분야에 맞게 조정됩니다.

아이러니하게도 TCL 을 "도구 명령 언어"로 방금 들었다면 DSL처럼 다양한 도구에 대한 많은 TCL 이있을 것이라고 생각할 수 있습니다.하지만 특정 스크립팅 언어의 특정 이름은 아닙니다.


특정 영역의 문제를 해결하기에 적합한 언어라고 생각합니다. 규칙 처리 언어 또는 서비스 설명 언어 일 수 있습니다.

DSL (도메인 특정 언어)의 반대는 범용 언어 입니다.


모든 것이 DSL입니다 ...

어셈블러 : MOV R1 ~ R2
컴파일러 : 할당 문-A = A + 1, 조건문-IF (TRUE) ..., 분기-RETURN
HTML : ... 중첩 구조 설명
TCP / IP : 설명 대상 / 시작 주소
PDF : 종이에 텍스트 / 이미지 배치
설명 글꼴 : 문자 설명

특정 프로세스를 설명하는 데 사용하는 모든 언어는 DSL입니다. 안타깝게도 가장 기본적인 프로세스도 설명 할 수있는 도메인 별 언어가 부족하므로 모든 작업을 설명하는 데 필요한 몇 가지 언어를 사용합니다. "내 웹 사이트의 모든 html 파일 압축"을 완료하려면 300 줄의 3 개 또는 4 개 언어가 필요합니다.

DSL을 구축하려면 기억할 수 있고 문서가 필요하지 않은 프로세스를 설명하는 데 필요한 최소 문자 수를 결정하십시오. 속도와 사용 편의성이 기본 설계 기준이라는 점을 기억하십시오. 구문 분석이 너무 빠르기 때문에 어떤 구문을 사용하든 괜찮습니다. 대부분의 경우 "매월 1 일에 직원에게 지불"구문으로 자연어를 선호하지만 도메인 특정은 도메인에 따라 다르며 가장 적합한 구문을 결정합니다. 문제에 맞습니다.

편리 할 수 ​​있지만 데이터 (XML)를 정의하는 데 사용 된 HTML과 같은 문제에 맞지 않는 다른 솔루션은 사용하지 않을 것입니다. CSV는 매우 유용하며 대부분의 문제에 적합합니다. JSON은 사용의 용이성 부분에 맞지 않으며, CSV가 대부분의 문제에서 작동하는 불필요한 합병증을 추가하는 것은 과잉입니다. 우리는 DSL에 EXCEL을 많이 사용합니다. 트리 구조 나 메뉴, A 열은 레벨, 다른 열은 아이콘, 색상, 레이블 등과 같은 65K에서 1M 행 미만의 작은 문제를 설명하는 데 적합합니다 (EXCEL은 편집 가능한 CSV).

HTML이 페이지 레이아웃의 문제를 실제로 해결하지 못한다는 것을 알았 기 때문에이를 제거하고 적합한 DSL을 정의했습니다. 페이지에서 HEADER, BODY, FOOTER, LEFT / RIGHT MARGINS 및 LEFT / RIGHT FULL MARGINS의 6 개 영역을 정의했습니다. 그런 다음 페이지 생성기에 TITLE BAR, STATUS BAR, MENUS, TABLE, FORMS, ...를 특정 셀에 추가하도록 지시 할 수 있습니다. 그런 다음 각 셀을 임의의 깊이까지 행과 열로 분할 할 수 있습니다. 페이지 레이아웃은 모든 스타일에 몇 초가 걸립니다.

BODY에는 직원 테이블이
포함되어 있습니다 .HEADER에는 Collins Software에 로그인 할 수있는 제목 표시 줄 캡션 'Hello World'가 포함되어 있습니다.

메뉴 DSL은 페이지 레이아웃 DSL에 맞지 않으므로 메뉴를위한 고유 한 DSL을 만들었습니다.

리소스 내 메인 메뉴
* define : menu, m, Level, Label, Icon, Action;
m, 0, 파일;
m, 1, open, open.gif, Dialog Open File;

각 문제는 고유하며, 컴퓨터는 모든 형식을 사용할 수 있으며, DSL이 설계된 것은 사람입니다. 따라서 사람이 이해할 수있게 만들고 입력 할 수있는 언어를 실제 단어로 만들 수 있습니다. 우리가 설명하는 것은 실제 사람, 장소, 사물이기 때문입니다.


DSL은 프로그래머가 아닌 사람이 사용할 언어를 개발하는 좋은 방법입니다. 예를 들어, 회사의 재무 담당자를위한 DSL이있는 경우 사양에 맞게 프로그래밍하는 대신 원하는 프로그램을 작성하도록 할 수 있습니다. 그런 다음 너무 느리면 작성한 내용을 원하는대로 가져와 컴파일 된 언어로 작성하여 속도를 높일 수 있습니다.


DSL 사용을 좋아하는 이유를 설명하는 간단한 블로그 게시물을 작성했습니다.

도메인 특정 언어 (DSL)를 사용했으면합니다.

여기에서 DSL을 다음과 같이 정의합니다.

A small programming language specifically designed to communicate solutions for a particular domain of problems.

In terms of use, if you've ever used Ant, Structured Query Language (SQL), or Cascading Style Sheets (CSS), you've used a DSL.

I like using DSLs because they focus on facilitating the communication of solutions to specific problem spaces, and they do so in a way that promotes the inclusion of domain experts.


Well! there is lot of things explained above. I will try to explain this in much simpler way as some one like me come will understand.

As general purpose languages are used for vast purposes the DSL is only made for specific domain. Like HTML or CSS.

You can say if you wrote instructions to a paper which only some person or your only best friend can understand and no one else could. Then it may be a DSL. But if you wrote instruction in such terms which many people could understand and could follow then this is not DSL.

I onces created a Switch board for user which could be operated via Serial port of a computer and User want a program for that board which could be executed on that board and Relay switches will be turned on and off accordingly. So I wrote some instructions and told the user to program that board according to these instructions. This is an example of DSL. I did not invented a new Language rather then I just created bunch of Strings that micro controller could read from EEPROM and could parse accordingly and could perform a specific task.


One simple example for Domain Specific Language(DSL) is HTML which is used for the particular domain called web-based applications.


I've just recently heard DSL but find a really helpful example: LUNA (former lunascript).

It's a custom-made programming language/framework made by Asana team for their own platform.

As I further find, many companies make their own frameworks and languages in order to create a proper competitive advantage, some examples are:

  • SAP with AbAp
  • PeopleSoft with PeopleCode
  • Apple with Objective-C
  • Facebook has things like FBML and FQL

Those are domain specific because you'll use them almost exclusively for working on these platforms.

I hope this answer helps you clarify on the concept.


An example of a DSL used in Machine Learning is patsy in python: https://patsy.readthedocs.io/en/latest/formulas.html#

which is based off the formula DSL from R: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/formula.html

https://cran.r-project.org/web/packages/Formula/vignettes/Formula.pdf

and Hadley has a nice section of his advanced R book that describes how to build a DSL w/R: http://adv-r.had.co.nz/dsl.html

Once the deep learning field stabilizes somewhat (or even now) I'd love to see something similar arise inside Apache MXnet project. However, I haven't seen any proposal for that on the proposal page yet though.


Domain-specific languages express your domain processes and knowledge in a language that directly uses the concepts and logic from your particular field.

The community is definitely growing but still not in the level of other "mainstream" technologies.

Most of the time, DSLs are made to improve productivity inside the companies, so they keep it private and don't share their results/insights.

Here is a conference where the speaker gives some examples of DSL using JetBrains MPS, with the technology of Projectional editing: https://vimeo.com/197381453


DSL - DomainSpecificLanguage

DSL is a computer language that's targeted to a particular kind of problem, rather than a general purpose language that's aimed at any kind of software problem.

Where: configurations(TravisCI .yaml), build scripts(gradle), describes a version of a Pod library(Podspec), UI programming(Anko) etc.

DSL is a declarative programming - What to do instead how to do

External DSLs have their own custom syntax and you write a full parser to process them(e.g. XML, RegExp, SQL, HTML, CSS, UML).

Internal DSLs are particular ways of using a host language to give the host language the feel of a particular language(e.g. Lisp, Ruby, Java annotations, macros).

Read more here, here

참고URL : https://stackoverflow.com/questions/809574/what-is-a-domain-specific-language-anybody-using-it-and-in-what-way

반응형