Traditional discussions of languages and parsing don't use a Semantic Model. There are occasions when an AST is an effective Semantic Model for a DSL, but these are the exception rather than the rule. It often will be a substantially different structure, and usually not a tree structure. The Semantic Model, however, is based on what will be done with the information from a DSL script. Although an abstract syntax tree may simplify and somewhat reorganize the input data, it still takes fundamentally the same form. A syntax tree corresponds to the structure of the DSL scripts.
You could use a DSL to describe object-relational mappings, and the resulting Semantic Model would consist of the Data Mappers, not the Domain Model that is the subject of the mapping.Ī Semantic Model is usually different from a syntax tree because they serve separate purposes. A good example of this is an object-relational mapper that coordinates data between an object model and a relational database.
A Domain Model captures the core behavior of an application, while a Semantic Model may play a supporting role. I use Domain Model to refer to a behaviorally rich object model, while a Semantic Model may be data alone. I use a separate term because although Semantic Models are often subsets of Domain Models, they don't have to be. 53.3生成带有嵌套条件的安全控制面板状态机(Velocity和Java生成的C)432Ī Semantic Model is a notion very similar to that of a Domain Model.