Visualization of C++ Template Metaprograms



Similar documents
Visualization of C++ Template Metaprograms

Syntax Check of Embedded SQL in C++ with Proto

Introduction to Generative Software Development

Industrial Adoption of Automatically Extracted GUI Models for Testing

Technical paper review. Program visualization and explanation for novice C programmers by Matthew Heinsen Egan and Chris McDonald.

Konzepte objektorientierter Programmierung

TEACHING COMPUTER PROGRAMMING WITH PROGRAM ANIMATION

JustClust User Manual

Refactoring Erlang Programs

Eclipse Web Tools Platform. Naci Dai (Eteration), WTP JST Lead

<Insert Picture Here> What's New in NetBeans IDE 7.2

Modeling Turnpike: a Model-Driven Framework for Domain-Specific Software Development *

Science of Computer Programming

A QUICK OVERVIEW OF THE OMNeT++ IDE

Using Eclipse CDT/PTP for Static Analysis

Pattern-based Program Visualization

FreeForm Designer. Phone: Fax: POB 8792, Natanya, Israel Document2

C#5.0 IN A NUTSHELL. Joseph O'REILLY. Albahari and Ben Albahari. Fifth Edition. Tokyo. Sebastopol. Beijing. Cambridge. Koln.

Getting Started with the LabVIEW Mobile Module

Implementing a Bidirectional Model Transformation Language as an Internal DSL in Scala

Compile-time Unit Testing

Component visualization methods for large legacy software in C/C++

Introducing Tetra: An Educational Parallel Programming System

Programmers rejoice: QML makes business people understand. Qt Developer Days 2014 Hinrich Specht 2. September 2014 Folie 1

Advanced Functional Programming (9) Domain Specific Embedded Languages

Feature list and feature comparison guide for v2.0 products

Textual Modeling Languages

Overview. Open source toolchains. Buildroot features. Development process

SBGNViz.js 1.1 User s Guide

Developing SQL and PL/SQL with JDeveloper

CoSMIC: An MDA Tool Suite for Application Deployment and Configuration

Pattern-based Program Visualization

1/20/2016 INTRODUCTION

Encapsulating Crosscutting Concerns in System Software

Extending XSLT with Java and C#

Model Transformations and Code Generation

CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014

Deitel Dive-Into Series: Dive Into Microsoft Visual C++ 6

For Introduction to Java Programming, 5E By Y. Daniel Liang

HAVING a good mental model of how a

Outside In Image Export Technology SDK Quick Start Guide

Introducing Variance into the Java Programming Language DRAFT

Software Engineering. Software Reuse. Based on Software Engineering, 7 th Edition by Ian Sommerville

Problems and Measures Regarding Waste 1 Management and 3R Era of public health improvement Situation subsequent to the Meiji Restoration

Development_Setting. Step I: Create an Android Project

Departamento de Investigación. LaST: Language Study Tool. Nº 143 Edgard Lindner y Enrique Molinari Coordinación: Graciela Matich

A standards-based approach to application integration

Dataflow Programming with MaxCompiler

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

A Java-based environment for teaching programming language concepts æ

A Sane Approach to Modern Web Application Development. Adam Chlipala February 22, 2010

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

Gallio: Crafting a Toolchain. Jeff Brown jeff.brown@gmail.com

CST STUDIO SUITE Introduction in VBA Macro usage and programming

Software Synthesis from Dataflow Models for G and LabVIEW

Parallel Debugging with DDT

Understanding Software Static and Dynamic Aspects

Compilation 2012 Domain-Specific Languages and Syntax Extensions

Model-Driven Development - From Frontend to Code

Programming with the Dev C++ IDE

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

VICCI. The Eclipse Modeling Framework (EMF) A Practical Introduction and Technology Overview. Dipl.-Inf. Christoph Seidl

Gadget: A Tool for Extracting the Dynamic Structure of Java Programs

An Internet Course in Software Development with C++ for Engineering Students

Extending Desktop Applications to the Web

OpenCCM: The Open CORBA Components Platform

Service Quality Analytics and Visualizations. SLA Suite

Desktop, Web and Mobile Testing Tutorials

Visualising Java Data Structures as Graphs

Embedded Software Development with MPS

POOSL IDE User Manual

The Mjølner BETA system

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005

A generic framework for game development

GEDAE TM - A Graphical Programming and Autocode Generation Tool for Signal Processor Applications

Thesis Proposal: Improving the Performance of Synchronization in Concurrent Haskell

Performance Analysis and Visualization of SystemC Models. Adam Donlin and Thomas Lenart Xilinx Research

Modeling Cloud Messaging with a Domain-Specific Modeling Language

Redesigning the language for business logic in the Maconomy ERP system and automatic translation of existing code

NetBeans IDE Field Guide

Cedalion A Language Oriented Programming Language (Extended Abstract)


Getting Started with the LabVIEW Mobile Module Version 2009

Simplifying the Development of Rules Using Domain Specific Languages in DROOLS

Enabling SSL and Client Certificates on the SAP J2EE Engine

Pro ASP.NET 4 CMS. Using the JET 4 Framework. Advanced Techniques for C# Developers. Apress. Alan Harris

A Deeper Look at Signals and Slots

Overview of Generative Software Development

GU-DSL A Generic Domain-Specific Language for Data- and Image Processing

A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION

Object Oriented Software Design II

Getting Started with CodeXL

MiniDraw Introducing a framework... and a few patterns

What s New in OMNeT++

The Smalltalk Programming Language. Beatrice Åkerblom

Acknowledgments. p. 55

Chapter 3.2 C++, Java, and Scripting Languages. The major programming languages used in game development.

Performance Management Platform

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111

Transcription:

Introduction Templight Debugger Visualizer Conclusion 1 Zoltán Borók-Nagy, Viktor Májer, József Mihalicza, Norbert Pataki, Zoltán Porkoláb Dept. Programming Languages and Compilers Eötvös Loránd University, Budapest, Hungary SCAM 2010 1 TÁMOP-4.2.1/B-09/1/KMR-2010-0003

Contents 1 Introduction 2 Templight 3 Debugger 4 Visualizer 5 Conclusion

C++ Templates Different from Java / C# generics Java / C#: type erasure C++: instantitation Mainly used for libraries: STL, etc. Templates are skeletons, code generated on demand Possibility for specialisation Recursive templates are ok

C++ Template Metaprogram - example template <int N> struct Factorial { enum { Value = N * Factorial<N-1>::Value}; }; template <> struct Factorial<0> { enum { Value = 1 }; }; int main() { std::cout << Factorial<5>::Value; }

C++ Template Metaprogram features Executed at compilation-time Functional paradigm Why we used them: optimalizations of runtime programs, expression templates static interface checking, concept checking compile-time code adoption, active libraries embedding DSLs Turing complete

Motivation Metaprogramming is side effect of template construct Template syntax is not helpful Compiler interprets metaprograms at compilation-time No user input, trivial printouts, etc. Maintenance is hopeless

Motivation Metaprogramming is side effect of template construct Template syntax is not helpful Compiler interprets metaprograms at compilation-time No user input, trivial printouts, etc. Maintenance is hopeless C++ template metaprogram code comprehension tools are essential

Templight Lightweight parser using boost wave and spirit Instruments template classes/functions injecting begin/end markers Markers emit compilation warnings on instantiation Collects warnings generating a "stack-trace" Post-mortem way Take advantage of compiler dependent implementation details (e.g. memoization)

Debugger Based on Templight GUI is based on QT Implements "usual" debugger features: Breakpoints, continue Step in/out/over Locals, watch Backward execution

Screenshot

Visualizer Based on Templight Transform the instantiation chain into a directed graph: nodes: types generated from templates edges show the instantiation requests Show corresponding code Filter out irrevelant nodes Export to png, jpg etc,

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Unruh Example Demonstration

Conclusion It is hard to understand and maintain C++ template metaprograms Visualization of programs is essential We have created a basic framework called Templight We have developed a graphical user interfaced post-mortem debugger We have implemented a tool to visualize the C++ template metaprograms as graphs

Controversial template <int p, int i> struct is_prime { enum { prim = (p==2) (p%i) && is_prime<(i>2?p:0),i-1>::prim }; }; template<> struct is_prime<0,0> { enum {prim=1}; }; template<> struct is_prime<0,1> { enum {prim=1}; };

Controversial C++ source is the assembly of template metaprogram. We have to use high level functional programming languages, like Haskell, to write metaprograms, and generate C++ source.

Controversial C++ source is the assembly of template metaprogram. We have to use high level functional programming languages, like Haskell, to write metaprograms, and generate C++ source. Thank you for attention