SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
Rascal Codefest
                                 Woensdag 3 maart 2010



                Jurgen Vinju
                && Tijs van der Storm
                && Bas Basten
                && Jeroen van den Bos
                && Mark Hills


Thursday, March 4, 2010
Installation art
                                                                            go ah
                                                                                 ea d!
                          Eclipse Galileo 3.5 for RCP/Plugin developers

                             32-bit version (yes, also on 64-bit machine)

                             32-bit Java run-time (JRE >= version 1.5)

                          Install plugins

                             http://download.eclipse.org/technology/imp/updates

                                 IMP run-time & IMP analysis features

                             http://www.meta-environment.org/updates

                                 Rascal feature


Thursday, March 4, 2010
Exam
                                   ple o p
                                           en so
                                                 urce
                                                      Java
                                                           proje
                                                                 ct
               http://www.rascal-mpl.org/releases/Prefuse.zip




             http://www.prefuse.org

Thursday, March 4, 2010
Rascal Team
              Paul        Jurgen      Tijs                    Bob
              Klint        Vinju   v/d Storm                 Fuhrer


                                                                  IBM




                                            A
                                     INRI         I/INR
                                                        IA
                                                CW

          Arnold  Bert
                         Bas Emilie Mark Jeroen
         Lankamp Lisser
                        Basten Balland Hills van den Bos
Thursday, March 4, 2010
Codefest
                  Lightning intro

                  Coding Game
                                          Ana
                                             lysis
                          analysis                !!
                                                              zatio n!!
                          visualization                Visuali

                     transformation         No Generat
                                                       ion to day
                  Disclaimers/Advertisements                  oday
                                                        sin gt
                                                  oPar
                                                N
Thursday, March 4, 2010
Meta Software
      (Static)
               s                                                   Program
      A nalysiDead code detection                            Tra
                                                  Goto elimination nsfor
                                                                         matio
                          Slicing/Dependence      Dialect transformation

                          Metrics                 Aspect weaving

                          Reverse engineering     DSL compilers

                          Verification             API migration

                          Architecture recovery   Model-to-code

                          Code-to-model           ...

                          ...
Thursday, March 4, 2010
Challenges
                          Diversity

                            languages, dialects, frameworks, api, ...

                          Multi-disciplinary

                            parsing, static analysis, transformation, ...

                          Efficiency versus precision

                            trade-off must be programmable


Thursday, March 4, 2010
Metaprogramming
                   Transformation                                            EASY

                          Source Code                                Input
                    Extraction            Generation   Extract


               Analysis          Models                Analyze     Abstraction
                                      Formalization    S
                  Visualization
                                                       Ynthesize


                             Pictures                                Output

                                      Conversion

Thursday, March 4, 2010
So, Rascal is a domain   specific language
                                     for
                                source code
                                    analysis
                                      and
                                transformation
                                      and
                                 visualization
                                      and
                                   generation
                                      and
                                  nothing less
                              (and nothing more)
Thursday, March 4, 2010
Use
                          File extension: .rsc

                          Open “Rascal Persective”

                            Use “New Rascal Project” wizard

                            Use “New Rascal File” wizard

                          Context-menu on Rascal projects

                            Start Console


Thursday, March 4, 2010
Read-Eval-Print

    rascal>1 + 1
    int: 2
    rascal>[1,2,3]
    list[int]: [1,2,3]
    rascal>{1,1,1}
    set[int]: {1}
    rascal>{ <i,i*i> | i <- [1..10]}
    rel[int,int]: {<1,1>,<2,4>,<3,9>,...



Thursday, March 4, 2010
Read-Eval-Print
           rascal>import IO;
           ok
           rascal>for (i <- [1..10]) {
           >>>>>>> println("<i> * <i> = <i * i>");
           >>>>>>>}
           1 * 1 = 1
           2 * 2 = 4
           3 * 3 = 9
           4 * 4 = 16
           5 * 5 = 25
           6 * 6 = 36
           7 * 7 = 49
           8 * 8 = 64
           9 * 9 = 81
           10 * 10 = 100
           list[void]: []
           rascal>


Thursday, March 4, 2010
Modules
     module path::to::Examples
     import IO;

     public int           fac(int n) {
       if (n ==           0) {
         return           1;
       }
       return n           * fac(n - 1);
     }




Thursday, March 4, 2010
From coding to declaring

     list[int] even(int max) {
       list[int] result = [];

             for (int i <- [0..max]) {
               if (i % 2 == 0) {
                 result += i;
               }
             }
             return result;
     }



Thursday, March 4, 2010
From coding to declaring

     list[int] even(int max) {
       list[int] result = [];

              for (int i <- [0..max], i%2 == 0) {
                  result += i;
              }
              return result;
     }



Thursday, March 4, 2010
From coding to declaring

     list[int] even(int max) {
       result = [];

              for (i <- [0..max], i%2 == 0) {
                  result += i;
              }
              return result;
     }



Thursday, March 4, 2010
From coding to declaring


 list[int] even(int max) {
   return for (i <- [0..max], i%2 == 0)
            append i;
 }




Thursday, March 4, 2010
From coding to declaring



 list[int] even(int max) {
   return [i | i <- [0..max], i%2 == 0];
 }




Thursday, March 4, 2010
Immutable values

                          WYSIWYG values           (“1”:1, “2”:2)
                            true, false            name(“Y.T.”)
                            1, 2, 3, ...           <1,2>, <1,2,1.0>
                            1.0, 1.1, 1.11111111   {<1,2>,2,1>}
                            [1,2,3]                Nest any way you
                                                   like
                            {1,2,3}


Thursday, March 4, 2010
Types
                                                                 value

                          list[void]: []

                          list[int]: [1]          int   str   list[value]   ...
                          list[value]: [1, “1”]

                          set[int]: {1}

                          set[value]: {1,”1”}                    void



Thursday, March 4, 2010
Sub-types
                                          value

                                                      list[value]
                                   real
                      int                                     list[real]
                                                  list[int]
                            bool



                             “A sub-type is a sub-set”
Thursday, March 4, 2010
Trees and Data
     node myNode = “person”(“Y.T”, 18);

     data Person = person(str name, int age)
                 | person(str first, str last);

     Person YT = person(“Y.T”, 18);
     Person MC = person(“Hiro”, “Protagonist”);




Thursday, March 4, 2010
Trees and Data
     node myNode = “person”(“Y.T”, 18);

     data Person = person(str name, int age)
                 | person(str first, str last);
                                    node
     Person YT = person(“Y.T”, 18);
     Person MC = person(“Hiro”, “Protagonist”);

                                   Person



Thursday, March 4, 2010
Switch
               bool isPerson(node t) {
                 switch (t)
                   case person(_,_) : return true;
                   case person(_,_,_) : return true;
                   default: return false;
                 }
               }




Thursday, March 4, 2010
Visit
   set[Person] personTrafo(set[Person] s) {
     return visit(s) {
       case person(str f, str l) =>
         person(“<l>,<f>”, 0)
       case person(str f, str l) : {
         name = “<l>, <f>”;
         println(name);
         insert name;
       }
     }
   }

Thursday, March 4, 2010
Booleans & Patterns
                 true && false, true || false, !true

                 true ==> false, true <==> false

                 all( i <- [2,4,6,8], i % 2 == 0)

                 int i := x

                 <int i, int j> := <1,”2”>

                 person(str name) <- {person(“x”)}

                 /<word:[a-z]+>/ <- [“123”,”abc”]

Thursday, March 4, 2010
Quoting & Antiquoting
       “Hello, I’m <myAge> year<s(myAge)> old”

       “class <className> {
          <for (<type, name> <- fields) {>
          <type> <name>;
          public <type> get<capitalize(name)>() {
            return this.<name>;
          }
          <}>
       }”



Thursday, March 4, 2010
Unfi
                          Concrete Syntax      nish
                                                   ed




    import lang::ansiC::CompilationUnit
    ...
    visit(s) {
      case `if(!<expr>) <stat1> else <stat2>` =>
           `if(<expr>) <stat2> else <stat1>`
    }




Thursday, March 4, 2010
Finally! Coding
                          Warm-up

                          Analyze & visualize a Java project

                            Extension Pie Chart / Histogram

                            Make a word cloud for Java code

                            Compute deepest inherited classes

                            Visualize a type hierarchy

                            Visualize source code metrics


Thursday, March 4, 2010
Warm-up
                      1 + 1, 4 / 2, 2 *   int a := b
                      2
                                          <a,b> = <1,2>;
                      int a = 1;
                                          if (1 > 2) println
                      b = 2;              (“x”);

                      import Set;         int fac(int n)
                                          { if (n == 0 )
                      max({1,2,3})        return 1; return n
                                          * f(n - 1); }
                      { i | i <-
                      [0..100]}           prime numbers?


Thursday, March 4, 2010
Extension Charts




Thursday, March 4, 2010
Extension Charts

                          Import Resources, viz::Figure::Render,
                          viz::Figure::Core, viz::Figure::Chart

                          |project://Prefuse|

                          loc l = ...; l.extension == “java”

                          Make a map[str, int]

                          myMap[elem]?0 += 1;


Thursday, March 4, 2010
Word cloud




                     Pick a single class, or it’s probably to o slow

Thursday, March 4, 2010
Word cloud
             import Resources

                     |project://myProjectName|

                     /file(loc l) := myResource

                     visit(myResource) { case file(l) : ... }

             import IO;

                     readFileLines

                     /<myWord:[A-Za-z0-9]+>/ := line

             Import viz::Figure::Core and Render

                     render, align, text, fontSize

                     |project://Prefuse/src/prefuse/data/parser/ByteParser.java|

Thursday, March 4, 2010
Deep Inheritance




Thursday, March 4, 2010
Deep Inheritance
                          Import JDT, Java, Resources, Set;

                          Compute set[str], “deepest inherited” classes
                            facts = extractProject(project);

                            rel[Entity, Entity] x = facts@extends;

                            x+; // transitive closure

                            str readable(Entity e);

                            int size(set[&T] s);

                            viz::Basic, treeView(...)



Thursday, March 4, 2010
Subtype graph




Thursday, March 4, 2010
Subtype graph

        Use viz::Figure::Core, viz::Figure::Render, JDT, Java, Resources, Set, Relation, and
        Graph modules

        Visualize (a part of) the type hierarchy:

               subtypes = facts@extends + facts@implements;

               subtypes += top(subtypes) * makeClass(“java.lang.Object”);

               filter on prefuse.data.expression.FunctionExpression using
               reach(...)

        graph([width(600),height(600)],[text([id(name)],name)|name
        <- ... ],[edge(from,to) | <from,to> <- ... ])



Thursday, March 4, 2010
Metrics




Thursday, March 4, 2010
Metrics
             construct a view with a box for each class:

                     classes: rel[loc,Entity] x = fact@types;

                     height is #methods: facts@declaredMethods

                     width is #fields: facts@declaredFields

                     color is #implemented interface, less is red, more is blue.

                          use loc.length

                          fillColor(Color c)

                          colorRange([...],color(“red”),color(“blue”);

             use pack([width(x),height(x)],[...])
Thursday, March 4, 2010
Thank you!
                      http://www.rascal-mpl.org

                      Feedback is welcome

                      Look out for more alpha releases:

                          static (type) checker

                          concrete syntax features

                          IDE generation                                        ! s"rce!
                                                                           Read
                      Cases

                          DSL implementation
                                                          Tip: h
                                                                ttp://www
                          Refactoring implementation                     .eclip
                                                                                se.or
                                                                                     g/imp
                          ...

Thursday, March 4, 2010

Contenu connexe

Similaire à Rascal Devnology Code Fest

Demo-driven Research 2007-11-28
Demo-driven Research 2007-11-28 Demo-driven Research 2007-11-28
Demo-driven Research 2007-11-28 Tudor Girba
 
Computing for Human Experience and Wellness
Computing for Human Experience and WellnessComputing for Human Experience and Wellness
Computing for Human Experience and WellnessAmit Sheth
 
IzPack - fOSSa 2009
IzPack - fOSSa 2009IzPack - fOSSa 2009
IzPack - fOSSa 2009julien.ponge
 
Scientific and Grid Workflow Management (SGS09)
Scientific and Grid Workflow Management (SGS09)Scientific and Grid Workflow Management (SGS09)
Scientific and Grid Workflow Management (SGS09)Cesare Pautasso
 
Tim - FSharp
Tim - FSharpTim - FSharp
Tim - FSharpd0nn9n
 
Smxeastbarbarastarr2012
Smxeastbarbarastarr2012Smxeastbarbarastarr2012
Smxeastbarbarastarr2012Barbara Starr
 
Kamaelia lightning2010opensource
Kamaelia lightning2010opensourceKamaelia lightning2010opensource
Kamaelia lightning2010opensourcekamaelian
 
Semantic Model-driven Engineering
Semantic Model-driven EngineeringSemantic Model-driven Engineering
Semantic Model-driven EngineeringSteffen Staab
 
HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗Bobby Chen
 
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF:  Lifting NLP Extraction Results to the Linked Data CloudNERD meets NIF:  Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data CloudGiuseppe Rizzo
 
Embracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codekamaelian
 
Rajat Pashine Resume
Rajat Pashine ResumeRajat Pashine Resume
Rajat Pashine Resumeguesteade98
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability PatternsRobert Treat
 
Is Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic neededIs Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic neededchiportal
 
Semantically-aware Networks and Services for Training and Knowledge Managemen...
Semantically-aware Networks and Services for Training and Knowledge Managemen...Semantically-aware Networks and Services for Training and Knowledge Managemen...
Semantically-aware Networks and Services for Training and Knowledge Managemen...Gilbert Paquette
 
The architecture of data analytics PaaS on AWS
The architecture of data analytics PaaS on AWSThe architecture of data analytics PaaS on AWS
The architecture of data analytics PaaS on AWSTreasure Data, Inc.
 
Beyond Passwords (Guidorizzi)
Beyond Passwords (Guidorizzi)Beyond Passwords (Guidorizzi)
Beyond Passwords (Guidorizzi)Michael Scovetta
 
UX and Business Analysts - Stop the Madness
UX and Business Analysts - Stop the MadnessUX and Business Analysts - Stop the Madness
UX and Business Analysts - Stop the MadnessAndrew Hinton
 

Similaire à Rascal Devnology Code Fest (20)

Demo-driven Research 2007-11-28
Demo-driven Research 2007-11-28 Demo-driven Research 2007-11-28
Demo-driven Research 2007-11-28
 
Jtf new
Jtf newJtf new
Jtf new
 
Computing for Human Experience and Wellness
Computing for Human Experience and WellnessComputing for Human Experience and Wellness
Computing for Human Experience and Wellness
 
IzPack - fOSSa 2009
IzPack - fOSSa 2009IzPack - fOSSa 2009
IzPack - fOSSa 2009
 
Scientific and Grid Workflow Management (SGS09)
Scientific and Grid Workflow Management (SGS09)Scientific and Grid Workflow Management (SGS09)
Scientific and Grid Workflow Management (SGS09)
 
Tim - FSharp
Tim - FSharpTim - FSharp
Tim - FSharp
 
Smxeastbarbarastarr2012
Smxeastbarbarastarr2012Smxeastbarbarastarr2012
Smxeastbarbarastarr2012
 
Kamaelia lightning2010opensource
Kamaelia lightning2010opensourceKamaelia lightning2010opensource
Kamaelia lightning2010opensource
 
Semantic Model-driven Engineering
Semantic Model-driven EngineeringSemantic Model-driven Engineering
Semantic Model-driven Engineering
 
HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗
 
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF:  Lifting NLP Extraction Results to the Linked Data CloudNERD meets NIF:  Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data Cloud
 
Jtf new
Jtf newJtf new
Jtf new
 
Embracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler code
 
Rajat Pashine Resume
Rajat Pashine ResumeRajat Pashine Resume
Rajat Pashine Resume
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability Patterns
 
Is Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic neededIs Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic needed
 
Semantically-aware Networks and Services for Training and Knowledge Managemen...
Semantically-aware Networks and Services for Training and Knowledge Managemen...Semantically-aware Networks and Services for Training and Knowledge Managemen...
Semantically-aware Networks and Services for Training and Knowledge Managemen...
 
The architecture of data analytics PaaS on AWS
The architecture of data analytics PaaS on AWSThe architecture of data analytics PaaS on AWS
The architecture of data analytics PaaS on AWS
 
Beyond Passwords (Guidorizzi)
Beyond Passwords (Guidorizzi)Beyond Passwords (Guidorizzi)
Beyond Passwords (Guidorizzi)
 
UX and Business Analysts - Stop the Madness
UX and Business Analysts - Stop the MadnessUX and Business Analysts - Stop the Madness
UX and Business Analysts - Stop the Madness
 

Plus de Devnology

Meetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenMeetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenDevnology
 
Software Operation Knowledge
Software Operation KnowledgeSoftware Operation Knowledge
Software Operation KnowledgeDevnology
 
Slides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWISlides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWIDevnology
 
Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205Devnology
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applicationsDevnology
 
Hacking Smartcards & RFID
Hacking Smartcards & RFIDHacking Smartcards & RFID
Hacking Smartcards & RFIDDevnology
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
Devnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software DevelopmentDevnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software DevelopmentDevnology
 
Devnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en ArchitectuurDevnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en ArchitectuurDevnology
 
Devnology Back to School III : Software impact
Devnology Back to School III : Software impactDevnology Back to School III : Software impact
Devnology Back to School III : Software impactDevnology
 
Devnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology
 
Introduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software VolcanoIntroduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software VolcanoDevnology
 
Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011Devnology
 
Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011Devnology
 
Spoofax: ontwikkeling van domeinspecifieke talen in Eclipse
Spoofax: ontwikkeling van domeinspecifieke talen in EclipseSpoofax: ontwikkeling van domeinspecifieke talen in Eclipse
Spoofax: ontwikkeling van domeinspecifieke talen in EclipseDevnology
 
Experimenting with Augmented Reality
Experimenting with Augmented RealityExperimenting with Augmented Reality
Experimenting with Augmented RealityDevnology
 
Unit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightUnit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightDevnology
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingDevnology
 
Devnology Fitnesse workshop
Devnology Fitnesse workshopDevnology Fitnesse workshop
Devnology Fitnesse workshopDevnology
 

Plus de Devnology (20)

Meetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenMeetup at SIG: Meten is weten
Meetup at SIG: Meten is weten
 
Software Operation Knowledge
Software Operation KnowledgeSoftware Operation Knowledge
Software Operation Knowledge
 
Slides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWISlides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWI
 
Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
Hacking Smartcards & RFID
Hacking Smartcards & RFIDHacking Smartcards & RFID
Hacking Smartcards & RFID
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Devnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software DevelopmentDevnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software Development
 
Devnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en ArchitectuurDevnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en Architectuur
 
Devnology Back to School III : Software impact
Devnology Back to School III : Software impactDevnology Back to School III : Software impact
Devnology Back to School III : Software impact
 
Devnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology back toschool software reengineering
Devnology back toschool software reengineering
 
Introduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software VolcanoIntroduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software Volcano
 
Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011
 
Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011
 
Spoofax: ontwikkeling van domeinspecifieke talen in Eclipse
Spoofax: ontwikkeling van domeinspecifieke talen in EclipseSpoofax: ontwikkeling van domeinspecifieke talen in Eclipse
Spoofax: ontwikkeling van domeinspecifieke talen in Eclipse
 
Experimenting with Augmented Reality
Experimenting with Augmented RealityExperimenting with Augmented Reality
Experimenting with Augmented Reality
 
Unit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightUnit testing and MVVM in Silverlight
Unit testing and MVVM in Silverlight
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
 
Devnology Fitnesse workshop
Devnology Fitnesse workshopDevnology Fitnesse workshop
Devnology Fitnesse workshop
 

Dernier

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 

Dernier (20)

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 

Rascal Devnology Code Fest

  • 1. Rascal Codefest Woensdag 3 maart 2010 Jurgen Vinju && Tijs van der Storm && Bas Basten && Jeroen van den Bos && Mark Hills Thursday, March 4, 2010
  • 2. Installation art go ah ea d! Eclipse Galileo 3.5 for RCP/Plugin developers 32-bit version (yes, also on 64-bit machine) 32-bit Java run-time (JRE >= version 1.5) Install plugins http://download.eclipse.org/technology/imp/updates IMP run-time & IMP analysis features http://www.meta-environment.org/updates Rascal feature Thursday, March 4, 2010
  • 3. Exam ple o p en so urce Java proje ct http://www.rascal-mpl.org/releases/Prefuse.zip http://www.prefuse.org Thursday, March 4, 2010
  • 4. Rascal Team Paul Jurgen Tijs Bob Klint Vinju v/d Storm Fuhrer IBM A INRI I/INR IA CW Arnold Bert Bas Emilie Mark Jeroen Lankamp Lisser Basten Balland Hills van den Bos Thursday, March 4, 2010
  • 5. Codefest Lightning intro Coding Game Ana lysis analysis !! zatio n!! visualization Visuali transformation No Generat ion to day Disclaimers/Advertisements oday sin gt oPar N Thursday, March 4, 2010
  • 6. Meta Software (Static) s Program A nalysiDead code detection Tra Goto elimination nsfor matio Slicing/Dependence Dialect transformation Metrics Aspect weaving Reverse engineering DSL compilers Verification API migration Architecture recovery Model-to-code Code-to-model ... ... Thursday, March 4, 2010
  • 7. Challenges Diversity languages, dialects, frameworks, api, ... Multi-disciplinary parsing, static analysis, transformation, ... Efficiency versus precision trade-off must be programmable Thursday, March 4, 2010
  • 8. Metaprogramming Transformation EASY Source Code Input Extraction Generation Extract Analysis Models Analyze Abstraction Formalization S Visualization Ynthesize Pictures Output Conversion Thursday, March 4, 2010
  • 9. So, Rascal is a domain specific language for source code analysis and transformation and visualization and generation and nothing less (and nothing more) Thursday, March 4, 2010
  • 10. Use File extension: .rsc Open “Rascal Persective” Use “New Rascal Project” wizard Use “New Rascal File” wizard Context-menu on Rascal projects Start Console Thursday, March 4, 2010
  • 11. Read-Eval-Print rascal>1 + 1 int: 2 rascal>[1,2,3] list[int]: [1,2,3] rascal>{1,1,1} set[int]: {1} rascal>{ <i,i*i> | i <- [1..10]} rel[int,int]: {<1,1>,<2,4>,<3,9>,... Thursday, March 4, 2010
  • 12. Read-Eval-Print rascal>import IO; ok rascal>for (i <- [1..10]) { >>>>>>> println("<i> * <i> = <i * i>"); >>>>>>>} 1 * 1 = 1 2 * 2 = 4 3 * 3 = 9 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36 7 * 7 = 49 8 * 8 = 64 9 * 9 = 81 10 * 10 = 100 list[void]: [] rascal> Thursday, March 4, 2010
  • 13. Modules module path::to::Examples import IO; public int fac(int n) { if (n == 0) { return 1; } return n * fac(n - 1); } Thursday, March 4, 2010
  • 14. From coding to declaring list[int] even(int max) { list[int] result = []; for (int i <- [0..max]) { if (i % 2 == 0) { result += i; } } return result; } Thursday, March 4, 2010
  • 15. From coding to declaring list[int] even(int max) { list[int] result = []; for (int i <- [0..max], i%2 == 0) { result += i; } return result; } Thursday, March 4, 2010
  • 16. From coding to declaring list[int] even(int max) { result = []; for (i <- [0..max], i%2 == 0) { result += i; } return result; } Thursday, March 4, 2010
  • 17. From coding to declaring list[int] even(int max) { return for (i <- [0..max], i%2 == 0) append i; } Thursday, March 4, 2010
  • 18. From coding to declaring list[int] even(int max) { return [i | i <- [0..max], i%2 == 0]; } Thursday, March 4, 2010
  • 19. Immutable values WYSIWYG values (“1”:1, “2”:2) true, false name(“Y.T.”) 1, 2, 3, ... <1,2>, <1,2,1.0> 1.0, 1.1, 1.11111111 {<1,2>,2,1>} [1,2,3] Nest any way you like {1,2,3} Thursday, March 4, 2010
  • 20. Types value list[void]: [] list[int]: [1] int str list[value] ... list[value]: [1, “1”] set[int]: {1} set[value]: {1,”1”} void Thursday, March 4, 2010
  • 21. Sub-types value list[value] real int list[real] list[int] bool “A sub-type is a sub-set” Thursday, March 4, 2010
  • 22. Trees and Data node myNode = “person”(“Y.T”, 18); data Person = person(str name, int age) | person(str first, str last); Person YT = person(“Y.T”, 18); Person MC = person(“Hiro”, “Protagonist”); Thursday, March 4, 2010
  • 23. Trees and Data node myNode = “person”(“Y.T”, 18); data Person = person(str name, int age) | person(str first, str last); node Person YT = person(“Y.T”, 18); Person MC = person(“Hiro”, “Protagonist”); Person Thursday, March 4, 2010
  • 24. Switch bool isPerson(node t) { switch (t) case person(_,_) : return true; case person(_,_,_) : return true; default: return false; } } Thursday, March 4, 2010
  • 25. Visit set[Person] personTrafo(set[Person] s) { return visit(s) { case person(str f, str l) => person(“<l>,<f>”, 0) case person(str f, str l) : { name = “<l>, <f>”; println(name); insert name; } } } Thursday, March 4, 2010
  • 26. Booleans & Patterns true && false, true || false, !true true ==> false, true <==> false all( i <- [2,4,6,8], i % 2 == 0) int i := x <int i, int j> := <1,”2”> person(str name) <- {person(“x”)} /<word:[a-z]+>/ <- [“123”,”abc”] Thursday, March 4, 2010
  • 27. Quoting & Antiquoting “Hello, I’m <myAge> year<s(myAge)> old” “class <className> { <for (<type, name> <- fields) {> <type> <name>; public <type> get<capitalize(name)>() { return this.<name>; } <}> }” Thursday, March 4, 2010
  • 28. Unfi Concrete Syntax nish ed import lang::ansiC::CompilationUnit ... visit(s) { case `if(!<expr>) <stat1> else <stat2>` => `if(<expr>) <stat2> else <stat1>` } Thursday, March 4, 2010
  • 29. Finally! Coding Warm-up Analyze & visualize a Java project Extension Pie Chart / Histogram Make a word cloud for Java code Compute deepest inherited classes Visualize a type hierarchy Visualize source code metrics Thursday, March 4, 2010
  • 30. Warm-up 1 + 1, 4 / 2, 2 * int a := b 2 <a,b> = <1,2>; int a = 1; if (1 > 2) println b = 2; (“x”); import Set; int fac(int n) { if (n == 0 ) max({1,2,3}) return 1; return n * f(n - 1); } { i | i <- [0..100]} prime numbers? Thursday, March 4, 2010
  • 32. Extension Charts Import Resources, viz::Figure::Render, viz::Figure::Core, viz::Figure::Chart |project://Prefuse| loc l = ...; l.extension == “java” Make a map[str, int] myMap[elem]?0 += 1; Thursday, March 4, 2010
  • 33. Word cloud Pick a single class, or it’s probably to o slow Thursday, March 4, 2010
  • 34. Word cloud import Resources |project://myProjectName| /file(loc l) := myResource visit(myResource) { case file(l) : ... } import IO; readFileLines /<myWord:[A-Za-z0-9]+>/ := line Import viz::Figure::Core and Render render, align, text, fontSize |project://Prefuse/src/prefuse/data/parser/ByteParser.java| Thursday, March 4, 2010
  • 36. Deep Inheritance Import JDT, Java, Resources, Set; Compute set[str], “deepest inherited” classes facts = extractProject(project); rel[Entity, Entity] x = facts@extends; x+; // transitive closure str readable(Entity e); int size(set[&T] s); viz::Basic, treeView(...) Thursday, March 4, 2010
  • 38. Subtype graph Use viz::Figure::Core, viz::Figure::Render, JDT, Java, Resources, Set, Relation, and Graph modules Visualize (a part of) the type hierarchy: subtypes = facts@extends + facts@implements; subtypes += top(subtypes) * makeClass(“java.lang.Object”); filter on prefuse.data.expression.FunctionExpression using reach(...) graph([width(600),height(600)],[text([id(name)],name)|name <- ... ],[edge(from,to) | <from,to> <- ... ]) Thursday, March 4, 2010
  • 40. Metrics construct a view with a box for each class: classes: rel[loc,Entity] x = fact@types; height is #methods: facts@declaredMethods width is #fields: facts@declaredFields color is #implemented interface, less is red, more is blue. use loc.length fillColor(Color c) colorRange([...],color(“red”),color(“blue”); use pack([width(x),height(x)],[...]) Thursday, March 4, 2010
  • 41. Thank you! http://www.rascal-mpl.org Feedback is welcome Look out for more alpha releases: static (type) checker concrete syntax features IDE generation ! s"rce! Read Cases DSL implementation Tip: h ttp://www Refactoring implementation .eclip se.or g/imp ... Thursday, March 4, 2010