SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
Ekeko
Applicative logic meta-programming
  using core.logic against Eclipse




              Coen De Roover
         Software Languages Lab
         Vrije Universiteit Brussel
Application: program querying
... commonly implemented by tool builders



                                                          {
                                                               syntactic
                           identify code with                  structural
                           characteristics of interest
                                                              control flow
                                                               data flow

e..g., method returning null
	
  public	
  List<Integer>	
  getChildren()	
  {
	
  	
  	
  	
  	
   return	
  null;
	
  }                                                                              idiom
                                                                   corpus       transformer
e..g., method returning empty collection                           miner
public	
  List<Integer>	
  getChildren()	
  {
	
  	
  	
  	
  	
   return	
  Collections.emptyList();
}


                                                          idiom
                                                          marker
                                                                             tools
Eclipse plugin
                       causally connected


Ekeko
        applications
            program querying

            program transformation

            corpus mining



meta-programming library
for Clojure’s core.logic
 logic meta-programming
   specify code characteristics declaratively, leave search to logic engine

 applicative meta-programming
     script queries over workspace
     manipulate workspace
select
programs to
   query



 start REPL



launch query



  browse
  results
Applicative meta-programming
... against Eclipse JDT using Clojure
                          Object
                                                                          rich in information: ASTs, semantics, structure

                        ASTNode




                                                    BodyDeclaration




                                                                                                  MethodDeclaration




     name            extraDimensions              thrownExceptions             returnType2           parameters       constructor        body   typeParameters    modifiers          javadoc




      SimpleName            int                        Name           Type             SingleVariableDeclaration        boolean         Block   TypeParameter    IExtendedModifier        Javadoc




                                                                                                                         statements




                                                                                                                         Statement




                                                                                                                      ReturnStatement       node
(spit	
  "jdt_docu_graph.dot"	
  
	
  	
  (dot/dot	
  (graph	
  [MethodDeclaration                                                                         expression         property
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  Block	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ReturnStatement])))                          Expression         value kind
Applicative meta-programming
... against Eclipse JDT using Clojure
                                                                      Lisp on JVM
 (defn	
  
 	
  	
  reduce-­‐projects!
 	
  	
  "Clojure	
  reduce	
  over	
  all	
  projects	
  in	
  the	
  workspace.
 	
  	
  	
  Destructive	
  as	
  it	
  opens	
  and	
  closes	
  each	
  project	
  sequentially."
 	
  	
  [f	
  initval	
  projects]
 	
  	
  (reduce	
  
 	
  	
  	
  	
  (fn	
  [sofar	
  p]
 	
  	
  	
  	
  	
  	
  (workspace-­‐project-­‐open!	
  p)
 	
  	
  	
  	
  	
  	
  (workspace-­‐wait-­‐for-­‐builds-­‐to-­‐finish)
 	
  	
  	
  	
  	
  	
  (let	
  [result	
  (f	
  sofar	
  p)]
 	
  	
  	
  	
  	
  	
  	
  	
  (workspace-­‐project-­‐close!	
  p)
 	
  	
  	
  	
  	
  	
  	
  	
  result))
 	
  	
  	
  	
  initval
 	
  	
  	
  	
  projects))

                                         lambda                                        Java interop

 =>	
  (reduce-­‐projects!	
  (fn	
  [sofar	
  p]	
  (conj	
  sofar	
  (.getName	
  p)))
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  []
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (workspace-­‐projects))
 ["AmbientTalk20080201"	
  "DesignPatterns"	
  "DissertationExamples"	
  "JHotDraw51"	
  
 "JavaTemplatesUnitTests"	
  "MLIForSootUnitTests"	
  "jEdit"]

                       but what if we want to know more than the name of each project?
Applicative logic meta-programming
... specify code characteristics through Ekeko relations, leave search to core.logic
                               collection of all substitutions for ?s and ?e



        (ekeko [?s ?e]
            (ast :ReturnStatement ?s)
            (has :expression ?s ?e)
            (ast :NullLiteral ?e))


                                   such that the following Ekeko relations hold:
                                          ast/2 holds for :ReturnStatement, ?s
                                                                                                ?e is the value of the
                                          has/3 holds for :expression, ?s, and ?e            property named :expression
                                                                                                    of ASTNode ?s
                                          ast/2 holds for :NullLiteral, ?e
   ([?s1 ?e2] ... [?sn ?en])

                   ([#<ReturnStatement return null;
                     #<NullLiteral null>]
                    ...
                    [#<ReturnStatement return null;
                     #<NullLiteral null>])                                          actual search performed by core.logic
Applicative logic meta-programming
... core.logic in a nutshell
               embedding of logic programming
                   port of Kanren [Friedman, Kiselyov, Bird] to Clojure by David Nolen
                   no operational impurities (e.g., cut), yet high performance
                   features tabling, extensible constraints, extensible unification protocols
  core.logic


                logic goals
                      functions that take a substitution
                        either return a possibly infinite stream of substitutions (success) or nil (failure)
                      constructors:
                         always success: s#, always failure: f#, success if arguments unify: ==

                 composing goals

                          introduces lexically scoped variables
                                 chains goals together                                           abstraction

                                                     (fresh	
  [?x	
  ?y]                        (defn	
  g	
  [?y]
                     (fresh	
  [?x	
  ?y]            	
  	
  	
  (conde	
                        	
  	
  (fresh	
  []
                     	
  	
  	
  (==	
  ?x	
  ?y)    	
  	
  	
  	
  [(==	
  ?x	
  1)	
  ..]     	
  	
  	
  	
  	
  (==	
  ?y	
  5)))	
  
                     	
  	
  	
  (==	
  ?x	
  5))    	
  	
  	
  	
  [(==	
  ?x	
  5)	
  ..]))   	
  
                                                                                                  (fresh	
  [?x]
                                                    interleaves substitutions from goals          	
  	
  (g	
  ?x))	
  
Applicative logic meta-programming
... using relations provided by the Ekeko library


                                                                    {
                                                                             syntactic
                                             concern                         structural
                                          characteristics                    control flow
                                                                             data flow




                                                                    {
                                                                              JDT DOM
                                                derived                       JDT Model
                                                 from                         control flow graph
                                                            SOOT data flow analyses
 e.g. relation of all JDT reference-valued expressions that may alias at run-time
      (defn	
  
      	
  	
  ast-­‐references-­‐may-­‐alias
      	
  	
  [?ast1	
  ?ast2]
      	
  	
  (fresh	
  [?set1	
  ?set2	
  ?model]
      	
  	
  	
  	
  (ast-­‐reference-­‐soot-­‐model-­‐points-­‐to	
  ?ast1	
  ?model	
  ?set1)	
  
      	
  	
  	
  	
  (ast-­‐reference-­‐soot-­‐model-­‐points-­‐to	
  ?ast2	
  ?model	
  ?set2)
      	
  	
  	
  	
  (succeeds	
  (.hasNonEmptyIntersection	
  ^PointsToSet	
  ?set1	
  ?set2))))
Applicative logic meta-programming
... in practice: specifying idiom characteristics incrementally
     (ekeko*	
  [?s	
  ?e]
     	
  	
  (ast	
  :ReturnStatement	
  ?s)	
                                 familiar query
     	
  	
  (has	
  :expression	
  ?s	
  ?e)	
  
     	
  	
  (ast	
  :NullLiteral	
  ?e))



     (defn
     	
  	
  statement-­‐returning-­‐null                                 query in reusable form
     	
  	
  [?s]
     	
  	
  (fresh	
  [?e]	
  
     	
  	
  	
  	
  (ast	
  :ReturnStatement	
  ?s)
     	
  	
  	
  	
  (has	
  :expression	
  ?s	
  ?e)
     	
  	
  	
  	
  (ast	
  :NullLiteral	
  ?e)))


     (defn	
  
     	
  	
  method-­‐returning-­‐null-­‐for-­‐type                                  same, but with the return type of the enclosing method
     	
  	
  [?m	
  ?t]
     	
  	
  (fresh	
  [?s]
     	
  	
  	
  	
  	
  	
  	
  	
  	
  (statement-­‐returning-­‐null	
  ?s)                      supposed to subtype java.util.Collection
     	
  	
  	
  	
  	
  	
  	
  	
  	
  (ast-­‐encompassing-­‐method	
  ?s	
  ?m)
     	
  	
  	
  	
  	
  	
  	
  	
  	
  (has	
  :returnType2	
  ?m	
  ?t)))
Applicative logic meta-programming
... in practice: specifying idiom characteristics incrementally
(defn
	
  	
  method-­‐returning-­‐null-­‐for-­‐ctype                                            same, but only if method returns a Collection type
	
  	
  [?method	
  ?ast-­‐type]
	
  	
  (fresh	
  [?k	
  ?c-­‐type	
  ?type]
	
  	
  	
  	
  	
  	
  	
  	
  	
  (type-­‐qualifiedname	
  ?c-­‐type	
  "java.util.Collection")                    what if there are many method exits?
	
  	
  	
  	
  	
  	
  	
  	
  	
  (method-­‐returning-­‐null-­‐for-­‐type	
  ?method	
  ?ast-­‐type)
	
  	
  	
  	
  	
  	
  	
  	
  	
  (ast-­‐type-­‐type	
  ?k	
  ?ast-­‐type	
  ?type)
	
  	
  	
  	
  	
  	
  	
  	
  	
  (type-­‐super-­‐type	
  ?type	
  ?collection-­‐type))


(defn
	
  	
  method-­‐always-­‐returning-­‐null-­‐for-­‐ctype                                                     same, but only if all paths through the method
	
  	
  [?m	
  ?t]                                                                                             end in a return statement that returns null
	
  	
  (fresh	
  [?cfg]
	
  	
  	
  	
  	
  	
  	
  	
  	
  (method-­‐returning-­‐null-­‐for-­‐ctype	
  ?m	
  ?t)
	
  	
  	
  	
  	
  	
  	
  	
  	
  (method-­‐cfg	
  ?m	
  ?cfg)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  (method-­‐cfg-­‐entry	
  ?m	
  ?entry)
	
  	
  	
  	
  	
  	
  	
  	
  	
  (qwal	
  ?cfg	
  ?entry	
  ?end	
  []
               	
  	
  	
  	
  	
  	
  	
  	
  (qall	
  
                                                          (q=>*)                                                     universally quantified regular path expression: 0
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (qcurrent	
  [?return]                                  or more transitions before reaching the end of the
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (statement-­‐returning-­‐null	
  ?s)))))))       path, which has to be a statement returning null

             Reinout Stevens’
                damp.qwal
The idiom marker tool in action




         continuously adds a marker next to ?m
Status

being ported from SOUL




 but you can already give it a spin!
      https://github.com/cderoove/damp.ekeko

Mais conteúdo relacionado

Mais procurados

Detecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic SearchDetecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic SearchShinpei Hayashi
 
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...Coen De Roover
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to ScalaRiccardo Cardin
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...Khushboo Jain
 
Oop2011 actor presentation_stal
Oop2011 actor presentation_stalOop2011 actor presentation_stal
Oop2011 actor presentation_stalMichael Stal
 
Qcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaQcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaMichael Stal
 
VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)Abhilash Nair
 
Corejava Online 100
Corejava Online 100Corejava Online 100
Corejava Online 100reynolds
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentalsHCMUTE
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpMichael Stal
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalMichael Stal
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in JavaGurpreet singh
 
Java Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and LoggingJava Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and LoggingRiccardo Cardin
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4Richard Jones
 

Mais procurados (18)

Detecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic SearchDetecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic Search
 
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to Scala
 
Extending and scripting PDT
Extending and scripting PDTExtending and scripting PDT
Extending and scripting PDT
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
 
Cheat Sheet java
Cheat Sheet javaCheat Sheet java
Cheat Sheet java
 
Oop2011 actor presentation_stal
Oop2011 actor presentation_stalOop2011 actor presentation_stal
Oop2011 actor presentation_stal
 
Qcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaQcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scala
 
VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)
 
Corejava Online 100
Corejava Online 100Corejava Online 100
Corejava Online 100
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation Stal
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in Java
 
Qno 2 (a)
Qno 2 (a)Qno 2 (a)
Qno 2 (a)
 
Java Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and LoggingJava Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and Logging
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4
 

Semelhante a Ekeko Technology Showdown at SoTeSoLa 2012

Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseLogic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseCoen De Roover
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondMario Fusco
 
Scoobi - Scala for Startups
Scoobi - Scala for StartupsScoobi - Scala for Startups
Scoobi - Scala for Startupsbmlever
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Agora Group
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
No more promises lets RxJS 2 Edit
No more promises lets RxJS 2 EditNo more promises lets RxJS 2 Edit
No more promises lets RxJS 2 EditIlia Idakiev
 
No More Promises! Let's RxJS!
No More Promises! Let's RxJS!No More Promises! Let's RxJS!
No More Promises! Let's RxJS!Ilia Idakiev
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoJoel Falcou
 
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...Tudor Dragan
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.Brian Hsu
 
Testing for share
Testing for share Testing for share
Testing for share Rajeev Mehta
 
Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010JUG Lausanne
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With ScalaKnoldus Inc.
 

Semelhante a Ekeko Technology Showdown at SoTeSoLa 2012 (20)

Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseLogic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with Eclipse
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
 
Scoobi - Scala for Startups
Scoobi - Scala for StartupsScoobi - Scala for Startups
Scoobi - Scala for Startups
 
Interpreter Case Study - Design Patterns
Interpreter Case Study - Design PatternsInterpreter Case Study - Design Patterns
Interpreter Case Study - Design Patterns
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011
 
EMFPath
EMFPathEMFPath
EMFPath
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
No more promises lets RxJS 2 Edit
No more promises lets RxJS 2 EditNo more promises lets RxJS 2 Edit
No more promises lets RxJS 2 Edit
 
No More Promises! Let's RxJS!
No More Promises! Let's RxJS!No More Promises! Let's RxJS!
No More Promises! Let's RxJS!
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.Proto
 
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...
 
Refactoring
RefactoringRefactoring
Refactoring
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
 
Testing for share
Testing for share Testing for share
Testing for share
 
Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With Scala
 

Mais de Coen De Roover

Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...Coen De Roover
 
A logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseA logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseCoen De Roover
 
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software RepresentationThe Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software RepresentationCoen De Roover
 
CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...
CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...
CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...Coen De Roover
 
The STADiUM language framework for capturing domain-specific interaction patt...
The STADiUM language framework for capturing domain-specific interaction patt...The STADiUM language framework for capturing domain-specific interaction patt...
The STADiUM language framework for capturing domain-specific interaction patt...Coen De Roover
 
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...Coen De Roover
 

Mais de Coen De Roover (6)

Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...
 
A logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseA logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in Eclipse
 
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software RepresentationThe Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
 
CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...
CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...
CrimeSPOT: Language Support for Programming Interactions among Wireless Senso...
 
The STADiUM language framework for capturing domain-specific interaction patt...
The STADiUM language framework for capturing domain-specific interaction patt...The STADiUM language framework for capturing domain-specific interaction patt...
The STADiUM language framework for capturing domain-specific interaction patt...
 
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
 

Último

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Ekeko Technology Showdown at SoTeSoLa 2012

  • 1. Ekeko Applicative logic meta-programming using core.logic against Eclipse Coen De Roover Software Languages Lab Vrije Universiteit Brussel
  • 2. Application: program querying ... commonly implemented by tool builders { syntactic identify code with structural characteristics of interest control flow data flow e..g., method returning null  public  List<Integer>  getChildren()  {           return  null;  } idiom corpus transformer e..g., method returning empty collection miner public  List<Integer>  getChildren()  {           return  Collections.emptyList(); } idiom marker tools
  • 3. Eclipse plugin causally connected Ekeko applications program querying program transformation corpus mining meta-programming library for Clojure’s core.logic logic meta-programming specify code characteristics declaratively, leave search to logic engine applicative meta-programming script queries over workspace manipulate workspace
  • 4. select programs to query start REPL launch query browse results
  • 5. Applicative meta-programming ... against Eclipse JDT using Clojure Object rich in information: ASTs, semantics, structure ASTNode BodyDeclaration MethodDeclaration name extraDimensions thrownExceptions returnType2 parameters constructor body typeParameters modifiers javadoc SimpleName int Name Type SingleVariableDeclaration boolean Block TypeParameter IExtendedModifier Javadoc statements Statement ReturnStatement node (spit  "jdt_docu_graph.dot"      (dot/dot  (graph  [MethodDeclaration expression property                                      Block                                        ReturnStatement]))) Expression value kind
  • 6. Applicative meta-programming ... against Eclipse JDT using Clojure Lisp on JVM (defn      reduce-­‐projects!    "Clojure  reduce  over  all  projects  in  the  workspace.      Destructive  as  it  opens  and  closes  each  project  sequentially."    [f  initval  projects]    (reduce          (fn  [sofar  p]            (workspace-­‐project-­‐open!  p)            (workspace-­‐wait-­‐for-­‐builds-­‐to-­‐finish)            (let  [result  (f  sofar  p)]                (workspace-­‐project-­‐close!  p)                result))        initval        projects)) lambda Java interop =>  (reduce-­‐projects!  (fn  [sofar  p]  (conj  sofar  (.getName  p)))                                          []                                          (workspace-­‐projects)) ["AmbientTalk20080201"  "DesignPatterns"  "DissertationExamples"  "JHotDraw51"   "JavaTemplatesUnitTests"  "MLIForSootUnitTests"  "jEdit"] but what if we want to know more than the name of each project?
  • 7. Applicative logic meta-programming ... specify code characteristics through Ekeko relations, leave search to core.logic collection of all substitutions for ?s and ?e (ekeko [?s ?e] (ast :ReturnStatement ?s) (has :expression ?s ?e) (ast :NullLiteral ?e)) such that the following Ekeko relations hold: ast/2 holds for :ReturnStatement, ?s ?e is the value of the has/3 holds for :expression, ?s, and ?e property named :expression of ASTNode ?s ast/2 holds for :NullLiteral, ?e ([?s1 ?e2] ... [?sn ?en]) ([#<ReturnStatement return null; #<NullLiteral null>] ... [#<ReturnStatement return null; #<NullLiteral null>]) actual search performed by core.logic
  • 8. Applicative logic meta-programming ... core.logic in a nutshell embedding of logic programming port of Kanren [Friedman, Kiselyov, Bird] to Clojure by David Nolen no operational impurities (e.g., cut), yet high performance features tabling, extensible constraints, extensible unification protocols core.logic logic goals functions that take a substitution either return a possibly infinite stream of substitutions (success) or nil (failure) constructors: always success: s#, always failure: f#, success if arguments unify: == composing goals introduces lexically scoped variables chains goals together abstraction (fresh  [?x  ?y] (defn  g  [?y] (fresh  [?x  ?y]      (conde      (fresh  []      (==  ?x  ?y)        [(==  ?x  1)  ..]          (==  ?y  5)))        (==  ?x  5))        [(==  ?x  5)  ..]))   (fresh  [?x] interleaves substitutions from goals    (g  ?x))  
  • 9. Applicative logic meta-programming ... using relations provided by the Ekeko library { syntactic concern structural characteristics control flow data flow { JDT DOM derived JDT Model from control flow graph SOOT data flow analyses e.g. relation of all JDT reference-valued expressions that may alias at run-time (defn      ast-­‐references-­‐may-­‐alias    [?ast1  ?ast2]    (fresh  [?set1  ?set2  ?model]        (ast-­‐reference-­‐soot-­‐model-­‐points-­‐to  ?ast1  ?model  ?set1)          (ast-­‐reference-­‐soot-­‐model-­‐points-­‐to  ?ast2  ?model  ?set2)        (succeeds  (.hasNonEmptyIntersection  ^PointsToSet  ?set1  ?set2))))
  • 10. Applicative logic meta-programming ... in practice: specifying idiom characteristics incrementally (ekeko*  [?s  ?e]    (ast  :ReturnStatement  ?s)   familiar query    (has  :expression  ?s  ?e)      (ast  :NullLiteral  ?e)) (defn    statement-­‐returning-­‐null query in reusable form    [?s]    (fresh  [?e]          (ast  :ReturnStatement  ?s)        (has  :expression  ?s  ?e)        (ast  :NullLiteral  ?e))) (defn      method-­‐returning-­‐null-­‐for-­‐type same, but with the return type of the enclosing method    [?m  ?t]    (fresh  [?s]                  (statement-­‐returning-­‐null  ?s) supposed to subtype java.util.Collection                  (ast-­‐encompassing-­‐method  ?s  ?m)                  (has  :returnType2  ?m  ?t)))
  • 11. Applicative logic meta-programming ... in practice: specifying idiom characteristics incrementally (defn    method-­‐returning-­‐null-­‐for-­‐ctype same, but only if method returns a Collection type    [?method  ?ast-­‐type]    (fresh  [?k  ?c-­‐type  ?type]                  (type-­‐qualifiedname  ?c-­‐type  "java.util.Collection") what if there are many method exits?                  (method-­‐returning-­‐null-­‐for-­‐type  ?method  ?ast-­‐type)                  (ast-­‐type-­‐type  ?k  ?ast-­‐type  ?type)                  (type-­‐super-­‐type  ?type  ?collection-­‐type)) (defn    method-­‐always-­‐returning-­‐null-­‐for-­‐ctype same, but only if all paths through the method    [?m  ?t] end in a return statement that returns null    (fresh  [?cfg]                  (method-­‐returning-­‐null-­‐for-­‐ctype  ?m  ?t)                  (method-­‐cfg  ?m  ?cfg)                    (method-­‐cfg-­‐entry  ?m  ?entry)                  (qwal  ?cfg  ?entry  ?end  []                (qall   (q=>*) universally quantified regular path expression: 0                              (qcurrent  [?return] or more transitions before reaching the end of the                                  (statement-­‐returning-­‐null  ?s))))))) path, which has to be a statement returning null Reinout Stevens’ damp.qwal
  • 12. The idiom marker tool in action continuously adds a marker next to ?m
  • 13. Status being ported from SOUL but you can already give it a spin! https://github.com/cderoove/damp.ekeko

Notas do Editor

  1. \n
  2. begin by explaining title,\nwhat is program querying\ncommonly implemented by tool builders who need to identify code with chars of interest\nfir instance, imagine you want ..\n
  3. \n
  4. \n
  5. begin by explaining title,\nwhat is program querying\ncommonly implemented by tool builders who need to identify code with chars of interest\nfir instance, imagine you want ..\n
  6. begin by explaining title,\nwhat is program querying\ncommonly implemented by tool builders who need to identify code with chars of interest\nfir instance, imagine you want ..\n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n