the aspect oriented design of the parser framework puma c
play

The Aspect-Oriented Design of the ++ Parser Framework Puma C/C - PowerPoint PPT Presentation

The Aspect-Oriented Design of the ++ Parser Framework Puma C/C Matthias Urban Daniel Lohmann Olaf Spinczyk pure systems GmbH Friedrich-Alexander University Technical University Magdeburg Erlangen-Nuremberg Dortmund 9th International


  1. The Aspect-Oriented Design of the ++ Parser Framework Puma C/C Matthias Urban Daniel Lohmann Olaf Spinczyk pure systems GmbH Friedrich-Alexander University Technical University Magdeburg Erlangen-Nuremberg Dortmund 9th International Conference on Aspect-Oriented Software Development Industry Track – March 16, 2010

  2. What is Puma Puma A generic framework for applications that have to parse, analyze, and optionally transform ++ source code. various flavors of C and C ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 2

  3. What is Puma Puma A generic framework for applications that have to parse, analyze, and optionally transform ++ source code. various flavors of C and C freely available under the GPL https://svn.aspectc.org/repos/Puma/trunk 83,000 lines of code developed and maintained by pure::systems GmbH , Magdeburg internally used for the development of client-specific solutions commercial licenses and support available used by – and implemented in – AspectC ++ ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 2

  4. Puma Application Examples The AspectC++ weaver ac++ aspect Cool { ac++ . . . . . . int main() { }; _Cool_invoke_a0(); Weaver int main() { . . . } . . . } Puma ++ Source (Woven) C ++ Source AspectC ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 3

  5. Puma Application Examples The AspectC++ weaver ac++ aspect Cool { ac++ . . . . . . int main() { }; _Cool_invoke_a0(); Weaver int main() { . . . } . . . } Puma ++ Source (Woven) C ++ Source AspectC A mutation testing tool for SystemC SC_MODULE (adder) { SC_MODULE (adder) { sc_in< int > a, b; sc_in< int > a, b; sc_out< int > sum; sc_out< int > sum; scm void do_add() { void do_add() { sum.write(a.read() sum.write(a.read() Mutator + b.read()) + ERR ; + b.read()); } } . . . . . . Puma }; }; (Mutated) SystemC Source SystemC Source ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 3

  6. ++ Parser Concerns of a C/C Primary job of a parser (greatly simplified) read tokens from input stream (keywords, identifier, operator symbols) invoke matching grammar rules Additional concerns (there are many!) syntax tree construction tentative parsing error handling connection to the semantic analysis lookahead optimizations ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 4

  7. ++ Parser Concerns of a C/C Primary job of a parser (greatly simplified) read tokens from input stream (keywords, identifier, operator symbols) invoke matching grammar rules Additional concerns (there are many!) syntax tree construction tentative parsing error handling connection to the semantic analysis lookahead optimizations State of the Art (for example, gcc/g++) All these concerns are tangled and scattered in the implementation! ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 4

  8. The Challenge 512 pages ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 5

  9. The Challenge 512 pages 816 pages of spec! ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 5

  10. The Challenge 700 pages (without .NET!) 512 pages 816 pages of spec! ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 5

  11. The Challenge 700 pages (without .NET!) 512 pages 816 pages of spec! 647 pages ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 5

  12. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  13. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  14. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  15. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  16. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  17. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  18. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  19. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  20. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  21. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  22. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  23. ++ Parsers and Manipulators A Family of C/C Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis Goal: Configurability and Extensibility Separation of concerns crucial for success! ➥ Aspect-oriented design and implementation ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  24. Focus of this Talk: Puma Parsers Puma Input Languages Analyses Transformation C++ C Dialects CPP Parsing & Sem. Analysis AST Matching AspectC++ MS Visual C++ GNU gcc/g++ Full Sem. Analysis Goal: Configurability and Extensibility Separation of concerns crucial for success! ➥ Aspect-oriented design and implementation ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Introduction 6

  25. Agenda 1 Introduction 2 Design Methodology 3 Separation of Concerns in Puma 4 Achievements 5 Wrap up ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Design Methodology 7

  26. Obliviousness and Quantification demystified C callee() knows callee P caller() Provider–Consumer Relationship without AOP Event provider has to know event consumer Control flows specified in the direction of knowledge ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Design Methodology 8

  27. Obliviousness and Quantification demystified C «aspect» C callee() exec("caller") knows callee knows "caller" P P caller() caller() Provider–Consumer Relationship with AOP Event consumer has to know event provider Advice specifies control flows against the direction of knowledge ➥ the mechanism behind “obliviousness” ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Design Methodology 8

  28. Obliviousness and Quantification demystified C «aspect» C callee() exec("caller") knows callee knows "caller" P P caller() caller() Provider–Consumer Relationship with AOP Advice specifies control flows against the direction of knowledge Control flow specification is inherently loose ➥ the mechanism behind “quantification” ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Design Methodology 8

  29. Methodology: Aspect- Aware System Design [USENIX 09] Basic Idea: Separation of Concerns in the Implementation one feature per implementation unit strict decoupling of policies and mechanisms ➥ use aspects as primary composition technique ++ Parser Framework (AOSD ’10) dl@cs.fau.de The Puma C/C Design Methodology 9

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend