U Xml Defense presentation


Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Name, Started in Dec 2007, Masters in CS (Languages and Tools)
  • I would like to tell the Applications of uXML first so that audiences understand what is the significance of uXML before understanding the core of it.
    Tools - developed the tools that uses uXML.
    Examples - uXML nodes,
    Extensibility - how you can add new components easily and extend uXML,
    Drawbacks - everything has drawbacks,
    Future Work - Things that I might think of adding in uXML, Summary, Q&A
  • 1960 form intermediate between problem-oriented languages and machine language
    M*N to M+N
    Explain the advantage of having a UIL - compilers, machine, etc.
    Why UNCOL failed? - Ambitious, no advanced compilers, not enough memory, slow machines
  • JVM - Bytecode is IL. Scala, JRuby, Jython, Groovy, Rhino. Small M, large N
    GNU - C, C++, Java converts to GENERIC, Small M, Large N
    .NET - CIL. VB, C#, F#, VC++, ASP. Large M, small N
    Phoenix - Framework for building compilers, CIL -> IR, tools like memory tracing, code coverage, block counting, Large M, small N
  • UNCOL - Already many tools
    Execution vs. Representation of semantics
    To prove - develop tools
  • Explain these as applications of a universal intermediate language
    s/w metrics tool - A common tool that does the code analysis of programs written in different paradigm
    education tool - compile framework, programs can be compared by metrics
    language converter - ambitious idea
    program structure - Extract the structure of a program
    The idea is how quickly can you develop a tool that is handy for wide range of languages
  • 2 tools so far - Interpreter and Code Analysis
    IR is validated against the uXML schema
  • Activation record - Enter the block, Leave the block,
    Symbol table - Add/remove symbol (datatype, mutable, name)
    Display - Data structure containing list of activation records to access the non-local variables
    Calling Sequence - Steps to be taken while calling/returing a function. Prototype for static/dynamic access
    Datatypes - Function, Int, Char, String, Overloaded function type
    2 parts - Backend and Front end
  • Programs are syntax trees. XML is also represented as trees
    Understandable - semantics are retain, no for loops in bytecode
    Processing tools - Extracting the data is easy, formatting, translating, thus many end users
    as oppose to MSIL or bytecode that has just 1 user and that is interpreter itself
  • Definition of each node
    Explain ‘scope’ and ‘var-declaration’ attributes in brief
  • Scoping - Context where values and expr are associated, how local variables are bound
    Static scoping - variable association at compile time
    Dynamic scoping - variable association at runtime
  • All languages contain if-else, while, for so won’t mention explicitly
  • Alike Java instantiation of object is needed before usage, else compiler throws error.
  • 1st parameter to the function/field is an object whose member is getting accessed.
    Parametric Polymorphism or Generics - Object as 1st parameter decides whose method to call
  • Closures
    Why operators are function? Code metrics
  • MCC - No. of linearly independent paths in the source code, control flow graph. Give eg.
    Helstead Metrics -
    Maintainability index - VS 2008 uses Helstead to calculate this factor.
  • Operators : N1 = Total , n1 = distinct
    Operands : N2 = Total , n2 = distinct
    Analogy of a book -
    Difficulty - increases with repetitive operands
    Volume - How much information to be absorbed
    Effort - efforts to write the code
    Time - in secs and 18 is stroud number - humans detect 5 to 20 moments/discrete events /sec - not used much
    jeh pointed out, Compare the programs with respect to difficulty, efforts, etc.
  • Advanced features - thread, read/write, file handling, interface, etc
    Missing programming paradigm - Logical, Aspect-oriented, Process oriented, etc.
  • uXML compiler can be improved to make it execute faster
    Comments - Part of Y language
  • There are lot of articles, however these points to some of the finest articles that helped me in developing the project.
  • U Xml Defense presentation

    1. 1. uXML An Experiment in Common Representation of Different Programming Paradigms Kunal S. Pathak
    2. 2. Outline History Extensibility Objective Drawbacks Applications Future Work Architecture Summary Tools Questions Examples Thank you
    3. 3. History Before UNCOL After UNCOL Programming Programming Machines languages Machines languages 1 1 1 1 2 2 U 2 N 2 3 3 C : O : : : N L N M M
    4. 4. Examples of UNCOL Sun’s Java framework GNU Compiler Collection Microsoft’s .NET and Phoenix framework
    5. 5. Objective Different from that of UNCOL Design an XML schema (uXML) to represent the semantics of different programming paradigms Test the uXML against various programming languages Develop tools that use uXML
    6. 6. Applications Software Metric tool Educational tool Plug-n-play Programming Language (specific paradigms) Source language converter tool Extract the program structure
    7. 7. Architecture uXML format C Program <uXML language="abc" scope="static"> Interpreter Program (XV) output <function name="func"> P Program <returns type="void"/> <block> ... uXML ... Schema Valid- </block> J Program ation </function> ... ... L Program <call> <variable name=”func” / Software > Code Analysis Metrics </call> Y Program ... </uXML> Front end Back end
    8. 8. Architecture cont. Compiler framework - Activation record, Symbol table, Display, Calling sequence, Datatypes Back end parser - uXML visitor Front end parsers - C, P, J, L and Y
    9. 9. Tools in uXML Code interpreter - xv • Visit uXML nodes and execute the respective code Code analysis - xv, xsl • Count the appropriate uXML nodes
    10. 10. Why XML in uXML? Program = Syntax tree = XML Human understandable Retains the semantics of the program Many XML processing tools - XSL, XSL-FO, XQuery, etc Universally accepted
    11. 11. Few uXML elements <var/>, <variable/>, <constant/> <assign/>, <operator/>, <for-loop/>, <iterate/>, <cast/> <function/>, <class/>, <constructor/>, <block/>, <call/> ‘scope’ and ‘var-declaration’ attribute of <uXML/>
    12. 12. PL features handled by uXML Iterations, if-else, arrays, pointers Function definition/call, nested procedures, functions as first-class objects Static vs. Dynamic Typing and Scoping Classes, Constructors, Inheritance
    13. 13. Front end Parsers C - Similar to Dennis Ritchie’s C P - Similar to Niklaus Wirth’s Pascal J - Similar to Sun Microsystem’s Java L - Similar to John McCarthy’s Lisp Y - Similar to Van Rossum’s Python
    14. 14. Features of C language Imperative/Declarative language Multi-dimensional arrays, type casting Pointers and Function pointers (FP) Passing/returning FP, Passing/returning array of FP, FP within FP
    15. 15. Sample C code 1.Clike - Factorial calculation 1.uXML - uXML equivalent 2.Clike - Function pointer
    16. 16. Features of P language Imperative/Declarative language Features similar to those of C except pointers Nested procedures and procedure parameters Non-local variable access using static and dynamic scoping
    17. 17. Sample P code 1.Plike - Static vs. Dynamic scoping 1.uXML - uXML equivalent 2.Plike - Procedure parameters
    18. 18. Features of J language Object oriented language Class and constructor definitions Inheritance and hierarchical constructor calls Object instantiation prior to usage
    19. 19. Sample J code 1.Jlike - Inheritance 1.uXML - uXML equivalent 2.Jlike - Constructor Calls
    20. 20. Features of L language Functional language Functions as first-class objects Operators are functions defun / lambda functions let, setq, map, reduce features
    21. 21. Sample L code 1.Llike - Reduce 1.uXML - uXML equivalent 2.Llike - Let 3.Llike - Defun
    22. 22. Features of Y language Imperative/Dynamic language No variable declaration required, Dynamic typing Multi-dimensional mix arrays lambda function definition map, reduce features
    23. 23. Sample Y code 1.Ylike - Map 1.uXML - uXML equivalent 2.Ylike - Mix Arrays, lambda
    24. 24. Features of Code Analysis tool Name/count of function, variable, class, constructor definitions Count of function/constructor calls Count of methods overridden McCabe Cyclomatic complexity Helstead Metrics, Maintainability index
    25. 25. Software Metrics Function defined : 1 void main() ____________________________________________ function void main() {  Function calls : 1   int i = 2 * 2 + 2, j = 1; main     do { ____________________________________________         i = i - 1; Variables defined : 2 i : int         print("i=",i,(j+2)); j : int     }while(i); ____________________________________________      Constants used: 8 int : 2     i = 5; int : 2 } int : 2 int : 1 int : 1 string : i= int : 2 int : 5 ____________________________________________ McCabe Cyclomatic Complexity : 3 ____________________________________________ Classes defined : 0 ____________________________________________ Functions overriden : 0 _____________________________________ Nested Block Depth : 1
    26. 26. Helstead Metrics function void main() {    int i = 2 * 2 + 2, j = 1;     do {         i = i - 1;         print("i=",i,(j+2));     }while(i);          i = 5; }   Helstead Metrics : N1 = 9, n1 = 7, N2 = 16, n2 = 7 Program Length N => N1 + N2 = 25 Vocabulary Size n => n1 + n2 = 14 Program Volume V => N * log2(n) = 95.18387305144009 Difficulty Level D => (n1 / 2) * (N2 / n2) = 8.0 Program Level L => 1/D = 0.125 Effort to implement E => V*D = 761.4709844115207 Time to implement T = E/18 = 42.303943578417815 No. of bugs delivered B => E^(2/3)/3000 = 3.333333333333333E-4
    27. 27. Extensibility of uXML uXML schema - Add new programming language feature Front end compilers - Write a new language Software Metric tool - Add new metrics to measure the software
    28. 28. Drawbacks uXML code has larger code size All / Advanced features of languages not covered Many programming paradigms not included in uXML schema
    29. 29. Future Work Update uXML schema to incorporate different paradigms Make uXML compiler more efficient Robust programming language converter tool Source code as part of comments in equivalent uXML code
    30. 30. Misc. details of uXML Developed in Java Used Eclipse, JavaCC and xv tools Source code version control Approximately 150 test programs written Approximately 6 months of time
    31. 31. Summary uXML schema represents OO, procedural and functional paradigms Room to add more programming paradigms Common representation helps develop powerful code analysis tools All features of PL can’t be covered
    32. 32. uXML mentors Dr. James Heliotis • Idea of uXML • Programming language features Dr. Axel Schreiner • xv tool • XML processing tools
    33. 33. References XV, XPath, JavaCC The dragon book - Compilers UNCOL, Phoenix, MSIL C, Pascal, CLOS, Java, Python, Smalltalk, Scheme, Modula-2 λ, Types, Scope, Subprograms, Metrics
    34. 34. Questions or Suggestion?
    35. 35. Thank you!!