DSLs in Action的笔记(12)

>我来写笔记

按有用程度 按页码先后 最新笔记

  • 大句哥哥

    大句哥哥 (make pie, or invent universe)

    Domain separate into problem domain and solution domain. The problem domain is closed to business, while the solution domain map the implementation to problem domain. These 2 domain communicate with "domain vocabulary", which explain domain concepts to the outside world. DSL qualities: 1. specific problem area, 2. higher level of abstraction. DSL classify: + Internal DSL. Use the infrastructure...

    2013-05-18 17:49

  • 大句哥哥

    大句哥哥 (make pie, or invent universe)

    Internal DSLs fall into two categories: Embedded(Smart API, Reflective, Typed embedded) & Generative(Compile-time , runtime). Embedded DSLs: patterns in metaprogramming: + Implicit context and Smart APIs: - define the implicit context: Ruby(instance_eval) and Groovy(with) can also build the implicit context declaration, making DSL more readable. - use smart api, Manage side effect be out o...

    2013-05-19 22:37

  • 黄健宏

    黄健宏

    开发 DSL 时主要考虑的三件事: Integration issues Handling exceptions and errors Managing performance 关于集成需要注意的问题: (Internal DSL Integration) (External DSL Integration) 异常和错误的处理问题: 性能问题: (略过)

    2011-12-13 10:56   1人喜欢

  • 黄健宏

    黄健宏

    External DSL ,其实就是写编译器/解释器。 不过 DSL 的语法比一般的编程语言少很多,满足基本需求就可以,甚至不必是图灵完备的。 External DSL design follows the same lifecycle and principles of general-purpose language design. Although the statement is true in theory, it’s not all that grim when you consider that your DSL isn’t necessarily as complex in syntax and semantics as a general-purpose pro...

    2011-12-13 00:15

  • 黄健宏

    黄健宏

    Internal DSL 主要分为两种类型: Generative—Domain-specific constructs are transformed to generate code through compile-time macros, preprocessors, or some form of runtime meta-object protocol (MOP). Embedded—Domain-specific types are embedded within the type system of the host language. 这两种类型并不是互斥的,比如一个 Lisp 宏写的 Internal DSL 就是两种兼有。 实现 Internal DSL 时经常用到的一些...

    2011-12-12 22:21

  • 黄健宏

    黄健宏

    Internal DSL 的定义: An internal DSL is one that uses the infrastructure of an existing programming language (also called the host language of the DSL) to build domain-specific semantics on top of it. In most cases, an internal DSL is implemented as a library on top of the existing host language. As you see in figure 1.5, the internal DSL script is a thin veneer over the abstrac- tions of an u...

    2011-12-12 14:30

  • 黄健宏

    黄健宏

    DSL 执行的几种模式: 1. 作为 script 直接运行(比如 AWK) 2. 作为 bytecodes 在 VM 之上运行(比如 JAVA 系的DSL) 3. 作为编译器时的元语言运行(比如 Lisp) The script can directly execute the underlying model without any more code generation or manipulation. There might be an interpreter that directly interprets the script and runs it. The UNIX little programming languages awk and sed are examples ...

    2011-12-12 12:46

  • 黄健宏

    黄健宏

    DSL 的本质,创建元语言抽象,或者更直接地说,创建一种新语言。 In most cases, a DSL is nothing but a layer of abstraction over the host language that presents a domain-friendly interface to the business users. (It’s not always the host language. See section 1.5 for details about DSL classification.) You’re kind of extending the host language to implement another language on top of it. This conc...

    2011-12-12 12:40

  • 黄健宏

    黄健宏

    怎样写一个好的 DSL ? 恰当的抽象层次,面向用户的API,隐藏实现细节。 A DSL provides a direct mapping to the artifacts of the problem domain. If the problem domain has an entity named Trade, the DSL script must contain the same abstraction that plays the same role. The DSL script must use the common vocabulary of the problem domain. The vocabulary becomes the catalyst for better communication bet...

    2011-12-12 12:25

  • 黄健宏

    黄健宏

    DSL 和 GENERAL-PURPOSE PROGRAMMING LANGUAGE 不同的地方。 最重要的两点: A DSL is targeted at a specific problem area A DSL contains syntax and semantics that model concepts at the same level of abstraction as the problem domain does 使用 DSL 的好处: When you program using a DSL, you deal only with the complexity of the problem domain. You don’t have to worry about the implementation details o...

    2011-12-12 11:52

<前页 1 2 后页>

笔记是你写在书页留白边上的内容;是你阅读中的批注、摘抄及随感。

笔记必须是自己所写,不欢迎转载。摘抄原文的部分应该进行特殊标明。

DSLs in Action

>DSLs in Action