Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JetBrains MPS: Typesystem Aspect

182 views

Published on

Course "Domain-specific programming languages" (http://dsl-course.org). Developed by Mikhail Barash.

Published in: Software
  • Be the first to comment

  • Be the first to like this

JetBrains MPS: Typesystem Aspect

  1. 1. TypeSystem Aspect checking rules checking rules implement semantic error detection either concept or pattern condition whether the rule replaces rules associated with super-concepts block of statements to check error conditions and report errors/warnings message reference to the node that should be highlighted as the source of error editor in use 1 2 3
  2. 2. TypeSystem Aspect inference rules calculate the types of instance nodes of a concept condition when the inference rule is active either concept or pattern condition not an “assignment operator” 2 3 4 quotation – to create nodes of concepts of a target language BaseLanguage/Java concept “string type” quotation is projected in target language type of a TextField node is BaseLanguage/Java’s string 51
  3. 3. TypeSystem Aspect inference rules type of an IntegerValue node is BaseLanguage/Java’s int type of a NumberField node is int integer value  number field type of a BooleanValue node is boolean type of a ToggleField node is boolean Boolean value toggle field integer Boolean
  4. 4. TypeSystem Aspect inference rules type of an FieldReference node is the type of the field it refers to establishes a restriction for a type of a certain node type of assigned value should be a (weak) subtype of type of assignee still an inference rule editor in use editor in use 1 2
  5. 5. Type inference concept UserField instances of entities – fields A x, where A is entity type of user field is a name of an entity extends abstract concept Field and thus can be used whenever a field is expected editor in use fields _a and _b are of type MyEntity 1 2 editor for concept UserField type checking has to be implemented separately now all user fields are implicitly of the same type
  6. 6. TypeSystem Aspect concept UserField type of user field is type of the entity to which userType refers editor in use 1 2 type of an entity is its name create a “static entity” with the same name “return” this “static entity” as the type of the entity
  7. 7. Physical units editor in use extends concept IntegerValue style of projected cell “unit” Inspector extends abstract concept Field 1 2 4 5 3 6
  8. 8. TypeSystem Aspect physical units type of an entity is its name
  9. 9. TypeSystem Aspect physical units

×