语义模型、自适应模型和 DSL
我正在阅读 DSL(Martin Fowler 的书),在第一章中他谈到了语义和自适应模型。我不太明白这些术语在 DSL 上下文中的含义。我尝试搜索和阅读更多有关它们的信息,但我仍然不太明白,因为解释也有点复杂。如果有人能用简单的术语向我解释这些,我将非常感激。谢谢。
I was reading about DSLs (Martin Fowler's book) and in the first chapter he talks about Semantic and Adaptive models. I dont really understand what these terms mean in the context of DSLs. I tried searching and reading more about them but I still dont quite get it since the explanations are also kind of complex. I would really appreciate if someone could explain these to me in simple terms. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这两种模式稍后都会在同一本书中进行更详细的解释,并且在 Fowler 的在线 DSL 模式中提供链接目录(尽管除了指向书中位置的指针之外,这些提供的信息很少)。第 11 章详细介绍了语义模型,第 47 章详细介绍了自适应模型。
基本上,语义模型是与语言紧密相关的模型,描述与语言相同的知识领域,由解析器直接创建。通常建议使用一个来将解析逻辑与语义逻辑分开。
自适应模型是一种用于定义替代计算模型(即通常不以宿主语言完成的计算模型)的技术,有时实际上是对计算 DSL 进行建模的语义模型。
These are both patterns explained in a bit more detail later in the same book and have links in Fowler's on-line DSL Pattern Catalog (though these provide little information beyond pointers to the locations in the book). Semantic Model is detailed in Chapter 11 and Adaptive Model is in Chapter 47.
Basically, a Semantic Model is a model tightly tied to the language, describing the same domain of knowledge that the language does, is created pretty directly by the parser. Using one is generally recommended for separating the parsing logic from the semantic logic.
Adaptive Model is a technique for defining an alternative computational model (i.e., a computational model not normally done in the host language), and is sometimes actually a Semantic Model modeling a computational DSL.