Debugging Natural Semantics Specifications Adrian Pop and Peter Fritzson Programming Environment Laboratory Department of Computer and Information Science.

Slides:



Advertisements
Similar presentations
1 CIS 461 Compiler Design and Construction Fall 2014 Instructor: Hugh McGuire slides derived from Tevfik Bultan, Keith Cooper, and Linda Torczon Lecture-Module.
Advertisements

UBI >> Contents Chapter 2 Software Development Tools Code Composer Essentials v3: Overview Texas Instruments Incorporated University of Beira Interior.
Peter Fritzson 1 MetaModelica for Meta-Modeling and Model Transformations Peter Fritzson, Adrian Pop, Peter Aronsson OpenModelica Course at INRIA, 2006.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Automated creation of verification models for C-programs Yury Yusupov Saint-Petersburg State Polytechnic University The Second Spring Young Researchers.
SSP Re-hosting System Development: CLBM Overview and Module Recognition SSP Team Department of ECE Stevens Institute of Technology Presented by Hongbing.
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
CS2200 Software Development Lecture 2: Java Program Development Lecturer: Adrian O’Riordan Course Webpage:
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
ModelicaXML A Modelica XML representation with Applications Adrian Pop, Peter Fritzson Programming Environments Laboratory Linköping University.
An Eclipse-based Integrated Environment for Developing Executable Structural Operational Semantics Specifications Adrian Pop and Peter Fritzson Programming.
A Portable Debugger for Algorithmic Modelica Code Adrian Pop, Peter Fritzson Programming Environments Laboratory (PELAB) Department of Computer and Information.
An framework for model-driven product design and development using Modelica Adrian Pop, Olof Johansson, Peter Fritzson Programming Environments Laboratory.
Natural Semantics Based Tools for Semantic Web with Application to Product Models Adrian Pop Programming Environments Laboratory (PELAB) Department of.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
OpenModelica Development Environment with Eclipse Integration Adrian Pop, Peter Fritzson, Andreas Remar, Elmir Jagudin, David Akhvlediani Programming Environment.
Building An Interpreter After having done all of the analysis, it’s possible to run the program directly rather than compile it … and it may be worth it.
Introduction & Overview CS4533 from Cooper & Torczon.
Contributions to Meta-Modeling Tools and Methods Adrian Pop Programming Environments Laboratory.
© 2008 IBM Corporation Behavioral Models for Software Development Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008.
COP4020 Programming Languages
Python Introduction.
OpenTS for Windows Compute Cluster Server. Overview  Introduction  OpenTS (academic) for Windows CCS  T-converter  T-microkernel  OpenTS installer.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Database Systems Group Department for Mathematics and Computer Science Lars Hamann, Martin Gogolla, Mirco Kuhlmann OCL-based Runtime Monitoring of JVM.
CSC141 Introduction to Computer Programming
Towards a Text Generation Template Language for Modelica Peter Fritzson *, Pavol Privitzer +, Martin Sjölund *, Adrian Pop * + Institute of Pathological.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Chapter Twenty-ThreeModern Programming Languages1 Formal Semantics.
Semantic Web and Natural Semantics Adrian Pop IDA/PELAB
Advanced Compiler Design An Introduction to the Javali Compiler Framework Zoltán Majó 1.
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
ProgrammingLanguages Programming Languages Language Definition, Translation and Design.
Compiler Principles Fall Compiler Principles Lecture 0: Local Optimizations Roman Manevich Ben-Gurion University.
Grid programming with components: an advanced COMPonent platform for an effective invisible grid © 2006 GridCOMP Grids Programming with components. An.
Evaluating Python as an Introductory Programming Language A. Thomas and H.L. Liang UNISA.
Eclipse 24-Apr-17.
Programming language. Definition Programming language is a formal language designed to communicate instructions to a computer. Programming languages can.
Graphene So what’s the most efficient way to spam all your Facebook friends? Team Adith Tekur (System Architect/Tester) Neha Rastogi (System Integrator)
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Celluloid An interactive media sequencing language.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Separating the Interface from the Engine: Creating Custom Add-in Tasks for SAS Enterprise Guide ® Peter Eberhardt Fernwood Consulting Group Inc.
Software Development Introduction
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
Chapter – 8 Software Tools.
© 2002 IBM Corporation Confidential | Date | Other Information, if necessary Copyright © 2009 Ericsson, Made available under the Eclipse Public License.
2000 Research Overview Dr. Kim Mens Programming Technology Lab Vrije Universiteit Brussel.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
COP4020 Programming Languages Introduction Prof. Robert van Engelen (modified by Prof. Em. Chris Lacher)
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Semantic Analysis. Find 6 problems with this code. These issues go beyond syntax.
Bootstrapping a Modelica Compiler Martin Sjölund, Peter Fritzson, Adrian Pop Linköping University th International Modelica Conference Dresden,
Functional Programming
Microprocessor and Assembly Language
CS 153: Concepts of Compiler Design November 30 Class Meeting
runtime verification Brief Overview Grigore Rosu
Names, Binding, and Scope
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
JIT Compiler Design Maxine Virtual Machine Dhwani Pandya
C++ Object Oriented 1.
Presentation transcript:

Debugging Natural Semantics Specifications Adrian Pop and Peter Fritzson Programming Environment Laboratory Department of Computer and Information Science Linköping University AADEBUG’2005, September 19-21, Monterey, Canada, USA

2 Outline  Introduction  Natural Semantics  Relational Meta-Language (RML)  The debugging framework for RML  Framework overview  Emacs integration  Data value browser  Demo  Conclusions and Future Work

3 Natural Semantics and Relational Meta-Language  Natural Semantics, a formalism widely used for specification of programming language aspects  type systems  static, dynamic and translational semantics  few implementations in real systems  Relational Meta-Language (RML)  a system for generating efficient executable code from Natural Semantics specifications  fast learning curve, used in teaching and specification of languages such as: Java, Modelica, MiniML, Pascal,..  developed by Mikael Petterson  “Compiling Natural Semantics” PhD Linköping University 1996  also as Springer Lecture Notes in Computer Science (LNCS) vol in 1999  previously no support for debugging.

4 Natural Semantics  Hi are hypotheses (environments)  Ti are terms (pieces of abstract syntax)  Ri are results (types, run-time values, changed environments)  Hj |- Tj : Rj are sequents  Premises or preconditions are above the line  Conclusion is below the line  Condition on the side if exists must be satisfied

5 Natural Semantics vs. Relational Meta–Language RML has the same visual syntax as Natural Semantics rule RelName1(H1,T1) => R1 &... RelNameN(Hn,Tn) => Rn & RelName(H, T) => R RML language properties  Separation of input and output arguments/results  Statically strongly typed  Polymorphic type inference  Efficient compilation of pattern-matching

6 Natural Semantics vs. Relational Meta-Language Natural Semantics formalism Relational Meta-Language module exp1: (* Abstract syntax of language Exp1 *) datatype Exp = INTconst of int | ADDop of Exp * Exp | SUBop of Exp * Exp | MULop of Exp * Exp | DIVop of Exp * Exp | NEGop of Exp relation eval: Exp => int end

7 Natural Semantics vs. Relational Meta-Language Natural Semantics formalismRelational Meta-Language relation eval: Exp => int = axiom eval(INTconst(ival)) => ival rule eval(e1) => v1 & eval(e2) => v2 & v1 + v2 => v eval( ADDop(e1, e2) ) => v3 rule eval(e1) => v1 & eval(e2) => v2 & v1 - v2 => v eval( SUBop(e1, e2) ) => v3 rule eval(e1) => v1 & eval(e2) => v2 & v1 * v2 => v eval( MULop(e1, e2) ) => v3 rule eval(e1) => v1 & eval(e2) => v2 & v1 / v2 => v eval( DIVop(e1, e2) ) => v3 rule eval(e) => v & -v => vneg eval( NEGop(e) ) => vneg end (* eval *)

8 The Need for RML Debugging  Facilitate language learning  run, stop and inspect features  Large specifications are hard to debug  Example: The OpenModelica compiler for Modelica  43 packages  lines of code  4054 functions  132 data structures  Also Java 1.2 specification ~18000 lines generating a bytecode compiler

9 The RML Debugging framework module Dump with “absyn.rml” relation dump: Absyn.Program => ()... RML AST FOL AST Parser Static Elaboration (Typecheck) AST to FOL FOL to CPS via Pattern-Matching Compiler CPS AST CPS to Code Code AST Linking with the RML runtime ANSI-C Code to ANSI-C Executable  The RML compiler phases Instrumentation with debug nodes at the AST level

10 The RML Debugging framework  Portable debugging framework based on code instrumentation and a small runtime interface; can be adapted/reused module Dump with “absyn.rml” relation dump: Absyn.Program => ()... RML Compiler External Program Database Linking with the RML debugging runtime ANSI-C Executable with Debugging RML Data Browser RML Debugging Emacs Mode

11 Debugger Implementation - Instrumentation (* Evaluation semantics of Exp1 *) relation eval: Exp => int = axiom eval(INTconst(ival)) => ival rule eval(e1) => v1 & eval(e2) => v2 & v1 + v2 => v eval( ADDop(e1, e2) ) => v3... end (* eval *) (* Evaluation semantics of Exp1 *) relation eval: Exp => int = axiom eval(INTconst(ival)) => ival ruleRML.debug_push_in01("e1",e1) & RML.debug(...) & eval(e1) => (v1) & RML.debug_push_out01("v1",v1) & RML.debug_push_in01("e2",e2) & RML.debug(...) => () & eval(e2) => (v2) & RML.debug_push_out01("v2",v2) & RML.debug_push_in02("v1",v1,"v2",v2) & RML.debug(...) & RML.int_add(v1,v2) => (v3) eval(ADDop(e1,e2)) => (v3)... end (* eval *)

12 Debugger Functionality (1) Breakpoints Stepping and Running

13 Debugger Functionality (2)  Additional functionality  viewing status information  printing backtrace information (stack trace)  printing call chain  setting debugger defaults  getting help Examining data  printing variables  sending variables to an external browser

14 Browser for RML Data Structures (1) Current Execution Point Variable value inspection

15 Browser for RML Data Structures (2) Data structure browsing Data structure definition

16 Conclusions and Future work  Conclusions  debugging framework for Natural Semantics  based on source code instrumentation  Emacs integration  data value browser  Future Work  debugging enhancements  Eclipse IDE integration  integration with static equation debugging, or with dynamic algorithmic debugging

17 Debugger Demo Demo

18 End Thank you! Questions?

19 Debugger Emacs integration  Emacs integration within GUD mode  Classical debugging facilities  breakpoints  stack trace  data inspection

20 Data Value Browser  Helps the user understand complex datatypes  Shows the execution point

21 Data Value Browser  Helps the user understand complex datatypes  Presents datatype definitions

22 Ideas for Presentation  Natural Semantics/Structured Operational Semantics common for specification of types systems, programming languages  RML is a language with efficient implementation of NS, compiling to C  The current work is first (to our knowledge) debugger for compiled NS  Portable debugging framework based on code instrumentation and a small interface; can be adapted/reused  Automatic mapping from data term to position in program where data was created  Emphasis on practical debugging of large specifications  Future work: Integration with static equation debugging, or with dynamic algorithmic debugging

23 RML example: the Exp language  Abstract syntax datatype Exp = INTconst of int | PLUSop of Exp * Exp | SUBop of Exp * Exp | MULop of Exp * Exp | DIVop of Exp * Exp | NEGop of Exp Exp: 10 * 12/3 SUBop INTconst DIVop INTconst