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,

Slides:



Advertisements
Similar presentations
Vilmos Zsombori , Shanghai
Advertisements

Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
© Chinese University, CSE Dept. Software Engineering / Software Engineering Topic 1: Software Engineering: A Preview Your Name: ____________________.
Systems Software.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
WPSM Programming Language A simple language that transform simple data structure into complex xML format Wai Y. Wong Peter Chen Seema Gupta Miqdad Mohammed.
1/18 CS 693/793 Lecture 09 Special Topics in Domain Specific Languages CS 693/793-1C Spring 2004 Mo, We, Fr 10:10 – 11:00 CH 430.
Programming Languages Structure
Transformation of Java Card into Diet Java Semester Project Presentation Erich Laube.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
SMIILE Finaly COBOL! and what else is new Gordana Rakić, Zoran Budimac.
© 2008 IBM Corporation Behavioral Models for Software Development Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008.
Research in Compilers and How it Relates to Software Engineering Part III: Relation to SE Tomofumi Yuki EJCP 2015 June 22, Nancy.
ANTLR.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Spectra Software Defined Radio Products Applying Model Driven Design, Generative Programming, and Agile Software Techniques to the SDR Domain OOPSLA '05.
PROGRAMMING LANGUAGES The Study of Programming Languages.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
1 Legacy System Evolution through Model-Driven Program Transformation Funded by the DARPA Information Exploitation Office (DARPA/IXO), under the Program.
Bridging the chasm between MDE and the world of compilation Nondini Das 1.
Framework for Automated Builds Natalia Ratnikova CHEP’03.
Levels of Independence in Aspect-Oriented Modeling Workshop on Model-driven Approaches to Middleware Applications Development June 17, 2003 Jeff Gray,
A Generative and Model Driven Framework for Automated Software Product Generation Wei Zhao Advisor: Dr. Barrett Bryant Computer and Information Sciences.
Robert Tairas, Marjan Mernik, Jeff Gray Using Ontologies in the Domain Analysis of Domain-Specific Languages Workshop on Transformation and Weaving Ontologies.
1 Grammar-Driven Generation of Domain-Specific Language Testing Tools Using Aspects Ph.D. Defense Hui Wu 10/29/2007.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Parser-Driven Games Tool programming © Allan C. Milne Abertay University v
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
{ Graphite Grigory Arashkovich, Anuj Khanna, Anirban Gangopadhyay, Michael D’Egidio, Laura Willson.
Building Tools by Model Transformations in Eclipse Oskars Vilitis, Audris Kalnins, Edgars Celms, Elina Kalnina, Agris Sostaks, Janis Barzdins Institute.
Grammar Variation in Compiler Design Carl Wu. Three topics Syntax Grammar vs. AST Component(?)-based grammar Aspect-oriented grammar.
Unit Testing for Domain-Specific Languages 1 Hui Wu, 1 Jeff Gray and 2 Marjan Mernik 1 University of Alabama at Birmingham, USA
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Hyper/J and Concern Manipulation Environment. The need for AOSD tools and development environment AOSD requires a variety of tools Life cycle – support.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Lesson 3 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
1 Research Directions Towards Software Maintenance, Adaptation and Modernization Grammar-based Software Technology - Spring 2006 Programming Lang. Seminar.
Model Driven Development An introduction. Overview Using Models Using Models in Software Feasibility of MDA MDA Technologies The Unified Modeling Language.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
INRIA - LaBRICharles Consel Jan-06 1 Domain-Specific Software Engineering Charles Consel Phoenix Research Group LaBRI /INRIA-Futurs January 2006.
McLab Tutorial Part 3 – McLab Frontend Frontend organization Introduction to Beaver Introduction to JastAdd 6/4/2011 Frontend-1McLab.
A Technique for Constructing Aspect Weavers using a Program Transformation Engine Jeff Gray Suman Roychoudhury Department of Computer and Information Sciences.
Towards the better software metrics tool motivation and the first experiences Gordana Rakić Zoran Budimac.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Semantics for DSL Group Members: Ritu Arora, Diyang Chu, Zekai Demirezen, Jeff Gray, Jacob Gulotta, Luis Pedro, Arturo Sanchez, Greg Sullivan,Ximing Yu.
A Two-Dimensional Separation of Concerns for Compiler Construction Carl (Xiaoqing) Wu, Suman Roychoudhury, Barrett R. Bryant and Jeffrey G. Gray The University.
Cross Language Clone Analysis Team 2 October 13, 2010.
Celluloid An interactive media sequencing language.
1 Model-based Aspect Weaver Construction Suman Roychoudhury Frédéric Jouault Jeff Gray {roychous, jouault, cis.uab.edu This project is supported.
Gordana Rakić, Zoran Budimac
Compiler Construction (CS-636)
LanguageLab A Meta-modelling Environment Terje Gjøsæter and Andreas Prinz, University of Agder, Norway SDL Forum 2015, Berlin, Germany.
 Programming - the process of creating computer programs.
1 Unit Testing for Domain-Specific Languages 1 Hui Wu, 1 Jeff Gray and 2 Marjan Mernik 1 University of Alabama at Birmingham, USA
DS(M)Ls for End-Users and Domain Experts? Panel on Creating DSLs Models in Software Engineering Workshop Zurich, Switzerland June 3, 2012 Jeff Gray University.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
A Model Transformation Approach to Automated Model Construction and Evolution Yuehua Lin Jeff Gray Department of.
A Framework for Developing Compiler-like Components Jackline Ssanyu ( Software Engineering and Technology Group) Eindhoven University of Technology Supervisors:
1 Extending the Eclipse Debug Perspective and JUnit to Support Testing and Debugging of Domain-Specific Languages August 16, 2005 Hui Wu and Jeff Gray.
©SoftMoore ConsultingSlide 1 Structure of Compilers.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
AUTOMATIC GENERATION OF MODEL TRAVERSALS FROM METAMODEL DEFINITIONS Authors: Tomaž Lukman, Marjan Mernik, Zekai Demirezen, Barrett Bryant, Jeff Gray ACM.
A Framework for Automated and Composable Testing of Component-based Services Miguel A. Jiménez, Ángela Villota, Norha M. Villegas, Gabriel Tamura, Laurence.
The PLA Model: On the Combination of Product-Line Analyses 강태준.
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
CS 153: Concepts of Compiler Design November 30 Class Meeting
Behavioral Models for Software Development
Implementing Language Extensions with Model Transformations
Implementing Language Extensions with Model Transformations
Graphical Modeling of INFOD applications
Presentation transcript:

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, and Suman Roychoudhury This Research is Supported by Eclipse Innovation Grant by IBM

Challenges with DSL Debugging Domain Experts program at DSL level DSL translated into General Purpose Language (GPL) Domain Experts deal with DSL Integrated Development Environment Editor Compiler Visualizer Debugge r Domain Experts deal with GPL

Difficulties with Constructing a DSL Debugger  A debugger is difficult to build because it depends heavily on the underlying operating system’s capabilities and lower-level native code functionality  Manual construction of the debugger for each new DSL can be time-consuming, expensive, and error-prone Motivation of building a DSL Debugger  Domain experts lack knowledge about the underlying GPL  Although techniques for constructing a debugger for a GPL have been developed over the years, debug support for DSLs has not been investigated deeply  The underlying GPL can be messy and human unreadable  One line of DSL can be translated into tens of lines of GPL code

Architecture of DSL Debugging Framework DSL grammar is defined using ANTLR Notation DSL is the input of the Lexer and Parser generated by ANTLR DSL translation process Robot DSL corresponding GPL code generated in Java Additional Mapping code generated in Java Corresponding GPL and Mapping Code are inputs of Mapping component jdb communicates with mapping component Eclipse Debugging perspective communicates with mapping component

Architecture of DSL Debugging Framework Reuse existing GPL standalone command line debugger Generative Programming techniques are used to synthesize debugger mapping code from DSL grammar specification Utilize the debugging methods mapping knowledge and source code mapping information to generate the DSL debugger in Eclipse Map the GPL debugger output messages back to the DSL level through the wrapper interface

Mapping Technique to Generate Debugger Source Code Mapping Source Code Mapping The source code mapping process uses the generated mapping information to determine which line of the DSL code is mapped to the corresponding segment of GPL code. It indicates the location of the GPL code segment. DSL Debugger Framework (DDF) Debug Methods Mapping The debug methods mapping process takes the user’s debugging commands from the debugger perspective at the DSL level to determine what type of debugging commands need to be issued to a command line debugger at the GPL level.

Debugging: A Crosscutting Grammar Concern dsllinenumber=dsllinenumber+1; gplbeginline=fileio.getLinenumber(); gplendline=fileio.getLinenumber(); filemap.print(" mapping.add(new Map("+dsllinenumber+", \"Robot.java\","+gplbeginline+","+gplendline+"));"); … command :( RIGHT { fileio.print("//move right"); fileio.print("x=x+1;"); fileio.print("time=time+1;"); fileio.print(" "); } |LEFT { fileio.print("//move left"); fileio.print("x=x-1;"); fileio.print("time=time+1;"); fileio.print(" "); } | … dsllinenumber=dsllinenumber+1; gplbeginline=fileio.getLinenumber(); gplendline=fileio.getLinenumber(); filemap.print(" mapping.add(new Map("+dsllinenumber+", \"Robot.java\","+gplbeginline+","+gplendline+"));"); Base Grammar Duplicate Debugging Aspect Code What if this line changes? Change here Change ……

First Approach: Weaving at GPL Level DSL Grammar ANTLR Parser Lexer In Java Debugging Aspect Specification In AspectJ AspectJ Compiler Parser’ Lexer’ With Debugging Aspects Weaved in DSL Code Debugging Mapping Code GPL In Java

First Approach: Weaving at GPL Level … 6 after(int commandname): 7 call(void antlr.Parser.match(int)) 8 && args(commandname) 9 { match(commandname); } 10 pointcut count_dsllinenumber(): 11 call (void P.command()); 12 after(): count_dsllinenumber(){ 13 { dsllinenumber=dsllinenumber+1;} … … try { // for error handling { switch ( LA(1)) { case RIGHT: case LEFT: case UP: case DOWN: case INIT: case SET: case PRINT: { command(); commands(); break; } case END: { System.out.println(" "); break; } default: { throw new NoViableAltException(LT(1), getFilename()); … Generated Parser code by ANTLR Debugging Aspect in AspectJ

First Approach: Weaving at GPL Level Disadvantages: The lack of mature aspect weavers for many languages (e.g., Object Pascal, C, or Ada) Requires the developer of the DSL to have detailed knowledge of the code generator within ANTLR in order to construct the appropriate pointcuts. In some case, the generated code is unreadable by a human

Second Approach: Weaving into DSL Grammars DSL Grammar ANTLR Debugging Aspect Specification In Parlanse Function Parser’ Lexer’ With Debugging Aspects Weaved in DSL Code Debugging Mapping Code GPL In Java DMS DSL Grammar’ With Debugging Aspect Weaved In

Second Approach: Weaving into DSL Grammars Transform actual DSL Grammar  Unique contribution of this paper Language independence. 12 Steps to Weave Debugging Aspects into DSL Grammar Level Using a Program Transformation Engine (DMS) 1. Specify ANTLR grammar specification 2. Specify Java semantic actions using DMS regular expression 3. Generate ANTLR Parser 4. Generate abstract syntax tree with ANTLR_ACTION nodes 5. Search ANTLR_ACTION nodes from the generated AST 6. Retrieve ANTLR_ACTION nodes and store them in a hash map 7. Retrieve associated string expression from each ANTLR_ACTION node 8. Modify the regular Java parser by changing the starting production 9. Parse the associated string expressions as regular Java statement lists 10.Transform the statement lists using the ASTInterface API 11.Regenerate the ANTLR_ACTION nodes with debugging aspects weaved in 12.Output the complete ANTLR AST (with modified action nodes) … command :( RIGHT { dsllinenumber=dsllinenumber+1; fileio.print("//move right"); fileio.print("x=x+1;"); fileio.print("time=time+1;"); gplbeginline=fileio.getLinenumber(); gplendline=fileio.getLinenumber(); fileio.print(" "); filemap.print(" mapping.add(new Map("+dsllinenumber+", \"Robot.java\","+gplbeginline+","+gplendline+"));"); } |LEFT { dsllinenumber=dsllinenumber+1; fileio.print("//move left"); fileio.print("x=x-1;"); fileio.print("time=time+1;"); gplbeginline=fileio.getLinenumber(); gplendline=fileio.getLinenumber() fileio.print(" "); filemap.print(" mapping.add(new Map("+dsllinenumber+", \"Robot.java\","+gplbeginline+","+gplendline+"));"); } …

DSL Debugger Perspective in Eclipse

Future Work More complex DSLs and different types of DSLs need to be investigated  Imperative, declarative, and hybrid DSLs Domain-Specific Language Unit Test Framework (DUTF) to complement the DDF Domain-Specific Language Profiler Framework (DPF) to monitor the runtime environment and performance of the DSL

Related Work SmartTools is a software factory which generate language development environment based on Java and XML technologies. But the tools like debugger, is not in the generation list. The Language Implementation System on Attribute Grammars (LISA) tool is a grammar-based system to generate a compiler, interpreter, and other language- based tools JastAdd is a Java based compiler construction system for AST transformation using JavaCC and tree- building using JJTree.

Conclusion This paper describes two different approaches to modularize the DSL debugger generation process. The second approach, which weaves debugging aspects directly into a DSL grammar, offers the most flexibility. Drawback of current effort  Initial learning curve for DMS is huge AspectANTLR to be developed to remove accidental complexities of using DMS  IDE platform is based solely on IBM Eclipse support for other IDEs will be needed  Experimentation performed only on a simple imperative DSL additional experimental validation needed for other types of DSLs

Questions? Summary of URLs referenced in talk  DSL Debugger Framework  ANTLR  AspectJ  DMS