Prasad1 Toward a Comprehensive Supplement for Language Courses Krishnaprasad Thirunarayan & Stephen P. Carl Department of Computer Science & Engineering.

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Advertisements

CS7100 (Prasad)L16-7AG1 Attribute Grammars Attribute Grammar is a Framework for specifying semantics and enables Modular specification.
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
CS 355 – Programming Languages
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics Fall 2005.
Object-Oriented Analysis and Design
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
NaLIX: A Generic Natural Language Search Environment for XML Data Presented by: Erik Mathisen 02/12/2008.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Object Oriented System Development with VB .NET
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Combining Static and Dynamic Data in Code Visualization David Eng Sable Research Group, McGill University PASTE 2002 Charleston, South Carolina November.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
1 On Embedding Machine-Processable Semantics into Documents Krishnaprasad Thirunarayan Department of Computer Science & Engineering Wright State University.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
Programming Paradigms cs784(Prasad)L5Pdm1. Programming Paradigm A way of conceptualizing what it means to perform computation and how tasks to be carried.
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
C++ fundamentals.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
CSE 341, S. Tanimoto Concepts 1- 1 Programming Language Concepts Formal Syntax Paradigms Data Types Polymorphism.
Formalizing and Querying Heterogeneous Documents with Tables Krishnaprasad Thirunarayan and Trivikram Immaneni Department of Computer Science and Engineering.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
CS 363 Comparative Programming Languages
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Programming Paradigms Procedural Functional Logic Object-Oriented.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Software Architecture & Complexity By:- Pardesi Band Group
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 2.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
CS112: Structure of Programming Languages A smorgasbord of topics in programming languages including programming paradigms and syntax, semantics, implementation.
Domain Driven Web Development With WebJinn Sergei Kojarski College of Computer & Information Science Northeastern University joint work with David H. Lorenz.
XML and Its Applications Ben Y. Zhao, CS294-7 Spring 1999.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
ISBN Chapter 3 Describing Semantics.
Chapter 3 Part II Describing Syntax and Semantics.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Introduction to Compiling
CSE 413 Languages & Implementation Hal Perkins Autumn 2012 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Operational Semantics (Slides mainly.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Advanced programming language theory. week 2. Attribute grammars and semantics.
The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. from Concepts of Programming Languages, 9th edition by Robert W. Sebesta,
Programming Languages 2nd edition Tucker and Noonan
Programming Paradigms
Chapter 1 Introduction.
PROGRAMMING LANGUAGES
WEB SERVICES.
Chapter 1 Introduction.
Implementing Language Extensions with Model Transformations
Representation, Syntax, Paradigms, Types
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
Programming Languages 2nd edition Tucker and Noonan
Principles of Programming Languages
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Motivation for Language Specification
Implementing Language Extensions with Model Transformations
Programming Paradigms
Presentation transcript:

Prasad1 Toward a Comprehensive Supplement for Language Courses Krishnaprasad Thirunarayan & Stephen P. Carl Department of Computer Science & Engineering Wright State University Dayton, OH-45435

Prasad2 Outline Relevance of techniques and tools for Programming Language (PL) Design and Implementation to Information Technology Simplified illustrative examples of related concepts and features Symptoms showing student lack of understanding of PL basics Concrete ways to improve assimilation of PL concepts and constructs with benefits to IT education via analogies

Prasad3 Information Systems : Representation and Processing Syntax “Standard” Language of Expression and Interchange  Code reuse (DOM)  Ease of parsing E.g., XML-DTD, which defines permissible data and attribute fields, based on context-free grammars (actually, Deterministic Extended Backus Naur Formalism) XML documents can be self-describing (using DTD schema) and hence, can be validated.

Prasad4 (cont’d) XML/DTD is just a context free grammar. A DOM is just a parse tree. An XML parser does the same job as LEX/YACC except that its interpreted.  P. Windley : Syntactic sugar makes the syntax of a language pretty. XML is syntactic arsenic.  P. Wadler : XML is just a notation for trees, a verbose variant of LISP S-expressions.

Prasad5 DTD Example <!DOCTYPE BOOK [ <!ELEMENT BOOK (OPENER,INTRODUCTION?,(SECTION | PART)+)> ]>

Prasad6 All About Me Welcome To My Book CHAPTER 1 Glad you want to hear about me. There's so much to say! Where should we start? How about more about me?

Prasad7 Semantics Machine processable tags embedded into human sensible documents ( Semantic Web )  Interoperability issues due to lack of consensus on the semantics of XML-tags Different concepts, same tags -> Context-sensitivity. Same concept, dissimilar tags -> Equivalence issue.  Transformations using recursive tree traversals  Content extractors/semantic taggers based on compiler-frontend tools

Prasad8 Reasoning Declarative specification and Querying  Logic and functional languages; Ontologies  Source to source transformations in Search Engines, Semantic Taggers, etc Defining Interface and Behaviors  Separation of concerns E.g., Web services context Reliability and Security  Type systems

Prasad9 Other Issues Portability across Platforms Standardization through specification  E.g., Language reference manuals Robust Architecture Smooth assimilation of changes, over time  E.g., Object-Oriented Paradigm Rapid Prototyping Improving programmer productivity  E.g., Scripting languages

Prasad10 Educational Gaps w.r.t. PL and IT In spite of good resources, students use technical jargon (and acronyms) without understanding them. describe a concept in abstract terms but cannot recognize or apply it concretely. use hackneyed examples when requested to provide illustrations.

Prasad11 Retrospective on Causes Examples are from correlated sources Different languages embody the same concepts using different syntax, and similar looking syntax in different languages can have subtly different semantics. E.g., Java and C++ syntax Inadequate mathematical training and maturity

Prasad12 Phil Windley summarizes the related IT education problem thus:  Most of the computing literature on XML, SOAP, and Web Services fails to relate these technologies back to CS theory and PL that any computer scientist should know.  The writings on these technologies is full of hype, making them seem more complicated than they are.  Most programmers are not familiar with RPC or messaging to any great extent and so their generalizations are even more obtuse.

Prasad13 A Proposal for Effective Teaching of Language Features and Techniques Develop an example-rich supplement that gets across language fundamentals and a comparative study of modern languages E.g., Focus on similarities, differences, subtleties, and trade-offs among related features E.g., Illustrate IT issues lucidly in a simpler setting Provide progressively difficult but well- integrated exercises, to apply and gauge, the grasp and appreciation of the material

Prasad14 Supplementary Topics and Materials for Comparative Languages Programming Styles Imperative style  L-values vs R-values E.g., assignment vs l-value yielding function Imperative vs Functional  Iteration vs Recursion E.g., I < R :: expressive power argument E.g., I /\ R :: tail-recursion and space-time trade-off

Prasad15 TAIL RECURSION: int fibtr(int n, int prev1, int prev2) { if (n == 0) return prev1; else if (n == 1) return prev2; else return fibtr(n-1, prev2, prev1 + prev2); }

Prasad16 Exercises : Specification and Implementation E.g., Parsing arithmetic expressions, type checking/inference, and generating bytecodes E.g.,  HW: Calculator for constant arithmetic expressions  PL: Augmenting expressions with variables, programmable calculator, etc E.g.,  Spec: Algebraic specification of Polynomials  HW: Implementing polynomials  PL: Augmenting polynomial calculator with memory, programmable polynomial calculator, etc

Prasad17 Procedural vs OOP Architecture Continuity : evolution under updates  In OOP Style, smooth assimilation of new implementation of an abstract behavior (E.g., data format changes)  In Procedural Style, smooth assimilation of new functionality Interfaces : Client-Server View  In Procedural Style, a client is responsible for invoking appropriate server action.  In OOP Style, a server is responsible for conforming to the standard interface, assumed by the client.

Prasad18 (define (size C) (cond ((vector? C) (vector-length C)) ((pair? C) (length C)) ((string? C) (string-length C)) ( else … )) )) (size '(one ``two'' 3))

Prasad19 interface iCollects { int size(); } class cVector extends Vector implements iCollects {} class cString extends String implements iCollects { public int size() { return length(); } } class cArray implements iCollects { int[] array; public int size() { return array.length; } } iCollects c = new cVector(); c.size();

Prasad20 Declarative vs Procedural  “Interpreter supplies control strategy for using the same declarative specification to answer different queries” append([], L, L). append([ H | T ], L, [ H | R ]) :- append(T, L, R). “.” and “:-” are logical connectives that stand for “and” and “if” respectively. “[]” and “|” stand for empty list and cons operation.

Prasad21  Concatenation sig: list x list -> list append([1], [2,3], R).  Verification sig: list x list x list append([1], [2,3], [1,2,3]).  Constraint solving sig: list x list -> list append( R, [2,3], [1,2,3]). sig: list -> list x list append(A, B, [1,2,3]).  Generation sig: -> list x list x list append(X, Y, Z).

Prasad22 Paradigm Comparison  Develop attribute grammar for static semantics of expressions  Modify to obtain an executable specification in a logic language (e.g., Prolog Definite Clause Grammars)  Convert into an object-oriented language (e.g., Java), a functional (e.g., Scheme) and an imperative language (e.g., C).  Explore relationship between magic sets in databases and attribute grammars Exercises

Prasad23 Programming Language Design Portability (“Importance of Language Definition”) #include main() { int i = 5; printf("\t i = %d, i/++i = %d, i = %d\n\n", i, i/++i, i); } /* Compilers: cc, gcc SUN3 : i = 6, i/++i = 1, i = 5 SPARC20: i = 6, i/++i = 1, i = 6 ALPHA : i = 5, i/++i = 1, i = 6 MIPS : i = 5, i/++i = 1, i = 6 INTUITION: i = 5, i/++i = 0, i = 6 */

Prasad24 Object-Oriented Languages  Class Static description; unit of modularity; type  Object Runtime structure  Inheritance and Polymorphism Code reuse  Polymorphism and Dynamic Binding Representation independence; Information hiding Interaction with type system  Inheritance vs Delegation

Prasad25 class P { public void f(P p) { System.out.println("f(P) in P. "); } } class C extends P { public void f(P p) { System.out.println("f(P) in C. "); } public void f(C cp) { System.out.println("f(C) in C. "); } }

Prasad26 class DynamicBinding { public static void main(String[] args) { P px = new P(); C cx = new C(); P py = cx; px.f(px); //f(P) in P. px.f(cx); //f(P) in P. py.f(px); //f(P) in C. py.f(cx); //f(P) in C. cx.f(px); //f(P) in C. cx.f(cx); //f(C) in C. }

Prasad27 Conclusion Discussed an example-rich approach to comparative languages Based on our experience, this approach is effective We believe that IT educators can benefit both from content and pedagogy proposed here.