abstract syntax can make the definition of modelica less
play

Abstract Syntax Can Make the Definition of Modelica Less Abstract - PowerPoint PPT Presentation

Abstract Syntax Can Make the Definition of Modelica Less Abstract 1st International Workshop on Equation-Based Object-Oriented Languages and Tools Berlin July 30, 2007 David Broman and Peter Fritzson Linkping University, Sweden


  1. Abstract Syntax Can Make the Definition of Modelica Less Abstract 1st International Workshop on Equation-Based Object-Oriented Languages and Tools Berlin July 30, 2007 David Broman and Peter Fritzson Linköping University, Sweden {davbr,petfr}@ida.liu.se Linköping University David Broman, davbr@ida.liu.se

  2. 2 Outline of the Talk Part I - Why are specification improvements needed? Specification Goals and Problems Part II - What to specify? Part III - How to specify? Previous Different Rejection Transformation Attempts Approaches Aspect Aspect Abstract Syntax Approach Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  3. 3 Part I Why are specification improvements needed? Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  4. 4 Problem: Interpreting the specification Interpretation of syntax and semantics Simulation Tool Modelica Language Specification � Dymola � Modelica System Designer Problem � MOSILAB - The Modelica Specification is open for interpretation � SimulationX - May result in incorrect and incompatible tools � OpenModelica Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  5. 5 Specification goals Unambigious "Can only be interpreted in exactly one way" Understandable "Easy to grasp with moderate computer science knowledge" Expressive "State the syntax and semantics in a compact manner" Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  6. 6 An evolutionary "middle-way" strategy Revolutionary Strategy Very large specification. Evolutionary Strategy . Abstract Syntax Approach Formal approach Informal approach e.g. operational semantics e.g. natural language text Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  7. 7 Part II What to specify? Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  8. 8 What should be specified? Syntax Semantics - the structure - the meaning R L sineVoltage R=10 L=1 Inertia1 k=1 spring E... c=1 J=0.1 1. Transformation Aspect G world y revolute r={L1,0,0} r={L2,0,0} a b b a b a b a bodyBox bodyBox1 n={0,0,1} n={0,0,1} x actuatedRev... Modelica Model Simulation Result R L sineVoltage R=10 L=1 Inertia1 k=1 spring E... c=1 2. Rejection Aspect J=0.1 G world y revolute r={L1,0,0} r={L2,0,0} a b b a b a b a bodyBox bodyBox1 n={0,0,1} n={0,0,1} x actuatedRev... Modelica Model Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  9. 9 Transformation Aspect What is actually the result of an execution? R L sineVoltage R=10 L=1 Inertia1 k=1 spring E... c=1 J=0.1 G world y revolute r={L1,0,0} r={L2,0,0} a b b a b a b a bodyBox bodyBox1 n={0,0,1} n={0,0,1} x actuatedRev... Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  10. 10 Rejection Aspect What is actually a valid Modelica model? R L R=10 L=1 sineVoltage Inertia1 k=1 spring E ... c=1 J=0.1 G world y revolute r={L1,0,0} r={L2,0,0} a b b a b a b a bodyBox bodyBox1 n={0,0,1} n={0,0,1} x actuatedRev... Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  11. 11 Part III How to specify? Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  12. 12 Previous Specification Attempts Types in Modelica Instance Creation (Elaboration) (Broman, Fritzson & Furic, 2006) (Mauss, 2005) - Only transformation aspect - Clarify the type concept in Modelica - Subset of the language - Concerns only the rejection aspect RML and Natural Semantics Modelica Specification (Kågedal & Fritzson, 1998) (Modelica Association, 2005) - 1998, large subset of specfication - Informal semantics, natural language - hard to get an overview of - became very large - Concrete syntax - now the code base for OpenModelica Formal approach Informal approach Abstract Syntax e.g. operational semantics e.g. natural language text Approach Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  13. 13 Abstract Syntax as a Middle-Way Strategy Elaboration (transformation and rejection aspects) � Input: Implicitly specified using concrete syntax Scanning, Parsing => � Output: Not specified � Abstract Syntax Tree (AST) Transformation: Informally specified using natural language Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  14. 14 Transformation and Rejection Aspects Rejection Aspect Transformation Aspect � � More restrictive than the concrete Precise specification of input syntax grammar and output (grammar) � � Include context sensitive information Transformation still informal � Still need informal rules (e.g. type rules) Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  15. 15 Example of a grammar fragment (S-AST) Modelica specification about connectors: "No equations are allowed in the definition or in any of its components" Key points � Extended BNF style � States allowed local class types and component types � States allowed prefixes � Meta-variables, declarative context-sensitive information � Verbose - intended for specification, not implementation Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

  16. 16 Concluding Summary How to specify What to specify Specification Goals � Current specification is � � Transformation Unambiguous informal, e.g. open for aspects � Understandable interpretation � Rejection aspects � Expressive � Evolutionary "middle-way" approach Abstract Syntax Approach Next Step � Specify INPUT and OUTPUT using grammars � Needs to be accepted � Complements the informal semantics by Modelica Association as the fundamental approach. � Yet another "specification" of a subset is less meaningful Thanks for listening! � There can only be one specification... Part I Part II Part III Why are specification What to specify? How to specify? Linköping University improvements needed? David Broman, davbr@ida.liu.se

Recommend


More recommend