The Stepping Stones. to Object-Oriented Design and Programming. Karl J. Lieberherr. Northeastern University, College of Computer Science

Size: px
Start display at page:

Download "The Stepping Stones. to Object-Oriented Design and Programming. Karl J. Lieberherr. Northeastern University, College of Computer Science"

Transcription

1 The Stepping Stones to Object-Oriented Design and Programming Karl J. Lieberherr Northeastern University, College of Computer Science Cullinane Hall, 360 Huntington Ave., Boston MA phone: (617) January 6, 1992 Texed at 17:35 January 6, 1992 Copyright c1989, 1990, 1991 Karl Lieberherr Abstract We partition the domain of object-oriented design and programming into a collection of easy to learn behavioral objectives. They have been developed and tested in industrial and academic courses on objectoriented design and programming and also in academic courses on programming languages, compilers and software design. This paper presents a renement of the teaching approach outlined in [LR89]. Keywords: Teaching object-oriented design and programming. 1 Behavioral objectives Object example graphs 1. Objective: Object example graph recognition. Behavior: Given a graph, determine whether it has the structure of an object example graph. Prerequisites: Basic mathematics. Negative examples: An edge is labeled by a vertex. 2. Objective: Object example graph textual representation. Behavior: Given a graph which has the structure of a class dictionary graph, write its textual description. Prerequisites: Object example graph recognition (1). 3. Objective: Legal object example graphs. Behavior: Given a list of object example graphs, decide whether they are legal. Prerequisites: Object example graph recognition (1). 1

2 Satellite : Military Civilian *common* <orbit> Orbit. Military = <orbit> Low_orbit. Civilian = <c> Country. Country = <x> Civilian. Fruit : Apple. Apple : Fruit. Figure 1: Class dictionary 4. Objective: Object example nding. Behavior: Given project specication, nd a \representative" list of object example graphs for input objects, output objects and intermediate objects. Prerequisites: Understanding of project specication, Object example graph recognition(1). Class dictionary graphs 5. Objective: Class dictionary graph recognition. Behavior: Given a graph, determine whether it has the structure of a class dictionary graph. Prerequisites: Basic mathematics. Negative examples: vertex. An alternation vertex has no outgoing alternation edge. An edge is labeled by a 6. Objective: Class dictionary graph graphical representation. Behavior: Given a mathematical description of a class dictionary graph, draw a picture of the graph. Prerequisites: Class dictionary graph recognition (5). 7. Objective: Class dictionary graph textual representation. Behavior: Given a graph which has the structure of a class dictionary graph, write its textual description. Prerequisites: Class dictionary graph recognition (5). 8. Objective: Class dictionary graph reachability. Behavior: Given a class dictionary graph and a vertex v, list all vertices which are 1. alternation-reachable, 2. construction-reachable, 3. inheritance-reachable, 4. containment-reachable from v. Prerequisites: Class dictionary graph recognition (5). 9. Objective: Legal class dictionary graph. Behavior: Given a class dictionary graph, determine whether it is legal. Prerequisites: Class dictionary graph recognition (5). Negative examples: The class dictionary in Fig. 1 violates the Cycle-Free Alternation Axiom since the path from Fruit to Apple and back forms an alternation cycle. It also violates the Unique Label Axiom since class Military has two parts labeled orbit (one immediate and one inherited).. 2

3 10. Objective: Partial class dictionary graph. Behavior: Given a class dictionary graph D and a subgraph S of D, determine whether S is a partial class dictionary graph of D. Prerequisites: Class dictionary graph recognition (5). Negative examples: A construction vertex of the subgraph has not all outgoing construction edges in the subgraph. 11. Objective: Inductive class dictionary graph. Behavior: Given a class dictionary graph D, determine whether it is inductive. Prerequisites: Legal class dictionary graph (9), Partial class dictionary graph (10). 12. Objective: Making class dictionary graph inductive. Behavior: Given a class dictionary graph D which violates the Inductiveness Axiom, nd a minimum class dictionary graph which satises the Inductiveness Axiom and whose objects include the objects of D. Prerequisites: Inductive class dictionary graph (11). 13. Objective: Law of Demeter for classes. Behavior: Given a class dictionary graph D, determine the number of vertices which are not inductive. Prerequisites: Legal class dictionary graph (9), Partial class dictionary graph (10). 14. Objective: Class dictionary graph learning. Behavior: Given a set of object example graphs, nd a class dictionary graph D so that Objects(D) contains only objects similar to the example graphs. Prerequisites: Legal object example graphs (3), Legal class dictionary graph (9). 15. Objective: Incremental class dictionary graph learning. Behavior: Given a class dictionary graph and a legal object example graph, extend the class dictionary graph so that it denes all objects which it dened before, plus additionally the new example object and objects similar to the example graph. Prerequisites: Class dictionary graph learning (14). 16. Objective: Class dictionary graph development. Behavior: Write a legal class dictionary graph for a given application domain. Prerequisites: Legal class dictionary graph (9), Legal object graph (27). 17. Objective: Class dictionary graph checking with objects. Behavior: Given a class dictionary graph and an object graph, decide whether the object is legal with respect to the class dictionary graph. If it is illegal, propose a change to either the class dictionary graph or the object graph to make the object graph legal with respect to the class dictionary graph. Prerequisites: Legal object graph (27), Part clusters (20). 18. Objective: Class dictionary graph translation. Behavior: Given a class dictionary graph, give a list of the generated C++ classes (interfaces and implementations). Prerequisites: Legal class dictionary graph (9), C++. Positive examples: See Fig. 2. 3

4 A = <b> B <c> C. B : C D. C =. D =. translation: class A { private: B* b; C* c; //... public: B* get_b() {return b;} void set_b(b* b_in) {b = b_in;} C* get_c() {return c;} void set_c(c* c_in) {c = c_in;} A(B* b_in = 0, C* c_in = 0){ b = b_in; c = c_in;} //... } Figure 2: C++ translation 19. Objective: Class dictionary graph parts. Behavior: Given a class dictionary graph, list all its parts. Prerequisites: Legal class dictionary graph (9). 20. Objective: Part clusters. Behavior: Given a class dictionary graph and a class, write down the part clusters of the class. Prerequisites: Legal class dictionary graph (9). 21. Objective: Object equivalence. Behavior: Given two class dictionary graphs, decide whether they dene the same set of objects. Prerequisites: Legal class dictionary graph (9), Legal object graph (27). Positive examples: The two class dictionaries in Fig. 3 dene the same set of objects. 22. Objective: Class dictionary graph attening. Behavior: Given a class dictionary graph, compute an object-equivalent class dictionary graph which does not have common parts.. Prerequisites: Object equivalence (21). 23. Objective: Parameterized class dictionary graph expansion. Behavior: Given a parameterized class dictionary graph, check whether it is legal and expand it into an equivalent (with respect to objects and sentences) non-parameterized class dictionary graph. Prerequisites: Legal class dictionary (32). Object graphs 4

5 A : B C D. B_or_c : B C. B =. C =. D =. A : B_or_c D. B_or_c : B C. B =. C =. D =. Figure 3: Object-equivalence 24. Objective: Object graph recognition. Behavior: Given a graph, determine whether it has the structure of an object graph with respect to a class dictionary graph. Prerequisites: Legal class dictionary graph (9). Negative examples: A vertex is labeled with a class which does not exist in the class dictionary graph. An edge is not labeled. 25. Objective: Object graph graphical representation. Behavior: Given an object graph, draw a picture of it.. Prerequisites: Object graph recognition (24). 26. Objective: Object graph textual representation. Behavior: Given an object graph, write its textual description. Prerequisites: Object graph recognition (24). 27. Objective: Legal object graph. Behavior: Given an object graph, determine whether it is legal with respect to a given class dictionary graph. Prerequisites: Legal class dictionary graph (9). Negative examples: The object graph with respect to the class dictionary graph shown in Fig. 4 is illegal since b cannot contain an F-object (only D- or E-objects are allowed) and since c cannot contain a D-object. There cannot be a d-part. Combine with Class dictionary graph checking with objects. 28. Objective: Object graph nding. Behavior: Given a class dictionary graph, nd 5 dierent objects which are legal with respect to the class dictionary graph. Prerequisites: Legal class dictionary graph (9), Legal object graph (27). 29. Objective: Object construction. 5

6 A = <b> B <c> C. B : D E *common* <f> F. C =. D =. E =. F =. object graph: :A( <b> :F() <c> :D() <d> E()) Figure 4: Class dictionary and object graph A = <b> B <c> C. B : C D. C =. D =. object graph: :A( <b> :C() <c> :C()) C++ program: i = new A(new C(), new C()); Figure 5: Object construction Behavior: Given a class dictionary graph and an object graph, write a C++ program which creates a C++ object corresponding to the object graph. Prerequisites: Legal class dictionary graph (9), Legal object graph (27), C++. Positive examples: See Fig. 5. Class dictionaries 30. Objective: Class dictionary recognition. Behavior: Given a mathematical structure, recognize whether it is a class dictionary. Prerequisites: Class dictionary graph recognition (5). Negative examples: The class dictionary in Fig. 6 is illegal since elements of V T cannot occur as alternatives. 31. Objective: Class dictionary textual representation. Behavior: Given a class dictionary, write its textual description. 6

7 Prefix : Ident Number Compound. Compound =. *terminal_sets* Ident, Number. Figure 6: Class dictionary A = "*" <b> B "+" "end". B : C D. C = "is" <s> String. D = "d" <i> Ident. object graph: A( <b> C( <s> String "*common*")) sentence: * is "*common*" + end object graph: :A( <b> :D( <i> :Ident "common")) sentence: * d common + end Figure 7: Objects and sentences Prerequisites: Class dictionary recognition (30). 32. Objective: Legal class dictionary. Behavior: Given a class dictionary, determine whether it is legal. Prerequisites: Legal class dictionary graph (9). 33. Objective: Class dictionary attening. Behavior: Given a class dictionary, compute with function CommonExpansion an object-equivalent class dictionary which does not have common parts. Prerequisites: Class dictionary graph attening (22). 34. Objective: Printing. Behavior: Given a class dictionary and an object graph, write the sentence which represents the object in the language dened by the class dictionary. Prerequisites: Legal class dictionary (32), Legal object graph (27). Positive examples: See Fig Objective: Language design. Behavior: Given an English description of a language, nd a class dictionary which denes that language. 7

8 A = <b> B <c> C <d> D. B : Empty B1. C : Empty B2. D = "end". Empty =. B1 = "b1". B2 = "b2". First sets: first(a) = {"b1", "b2", "end"}, first(b) = {empty, "b1"}, first(c) = {empty, "b2"}, first(d) = {"end"}, first(empty) = {empty}, etc. Figure 8: First sets Prerequisites: Printing (34). 36. Objective: Scanning. Behavior: Given a class dictionary and a character sequence, transform the characters into a terminal sequence (consisting of elements of and elements of the terminal sets in VT). Prerequisites: Class dictionary recognition (30). 37. Objective: First sets. Behavior: Given a class dictionary, compute the rst sets. Prerequisites: Legal class dictionary (32), Printing (34). Positive examples: See Fig Objective: Parsing. Behavior: Given a class dictionary and a sentence belonging to the language dened by the class dictionary, give the corresponding object graph. Recognize syntax errors. Prerequisites: Legal class dictionary (32), First sets (37). Positive examples: See Fig Objective: Sentence nding. Behavior: Given a class dictionary, nd 5 dierent sentences which are legal with respect to the class dictionary. Prerequisites: Legal class dictionary (32), Parsing (38). 40. Objective: Class dictionary checking with sentences. Behavior: Given a class dictionary and a sentence, decide whether the sentence is legal with respect to the class dictionary. If it is not legal, propose a change to the class dictionary and/or the sentence to make the sentence legal with respect to the class dictionary.. Prerequisites: Legal class dictionary (32), Legal object graph (27). 8

9 The sentence b1 end is syntactically correct and denes the object graph :A( <b> :B1() <c> :Empty() <d> :D()) The sentence b2 b1 end is syntactically incorrect since b1 must be before b2. Figure 9: Syntax analysis A = <b> B <c> C <d> D. B : Empty B1. C : Empty B2. D = "end". Empty =. B1 = "b1". B2 = "b2". Follow sets: follow(a) = {eof}, follow(b) = {"b2", "end"}, follow(c) = {"end"}, follow(d) = {eof}, follow(empty) = {"b2", "end"}, etc. Figure 10: Follow sets 41. Objective: Follow sets. Behavior: Given a class dictionary, compute the follow sets. Prerequisites: Legal class dictionary (32), First sets (37). Positive examples: See Fig Objective: LL(1) conditions. Behavior: Given a single-inheritance class dictionary, prove that it is LL(1). Given a multiple-inheritance class dictionary, prove that it satises the multiple-inheritance LL(1) conditions. Prerequisites: Legal class dictionary (32), Follow sets (41). Positive examples: The above class dictionary is LL(1) since rst(empty) is disjoint from rst(b1) and from rst(b2) and since follow(b) and rst(b1) are disjoint and since follow(c) and rst(b2) are disjoint. 43. Objective: LL(1) correction. 9

10 A = <b> B. B =. C = <b> B. A_or_c : A C *common* <b> B. A =. B =. C =. Figure 11: Common normal form Behavior: Given a single-inheritance class dictionary, add concrete syntax to make it LL(1). Given a multiple-inheritance class dictionary, add concrete syntax to make it satisfy the multiple-inheritance LL(1) conditions. Prerequisites: Legal class dictionary (32), (42). 44. Objective: Class dictionary development. Behavior: Given a project specication, develop a class dictionary for it. Prerequisites: Legal class dictionary (32), LL(1) correction (43). Class dictionary optimization 45. Objective: Equivalent parts. Behavior: Given a class dictionary graph, determine all pairs of parts which are equivalent. Given a class dictionary graph, transform it to an object-equivalent class dictionary graph where each part is only equivalent to itself. Prerequisites: Legal class dictionary graph (9). 46. Objective: Redundant part. Behavior: Given a class dictionary, nd all redundant parts. Prerequisites: Equivalent parts (45). 47. Objective: Common normal form. Behavior: Given a class dictionary graph, bring it to common normal form while preserving objectequivalence. Given a class dictionary, bring it to common normal form while preserving object-equivalence and language. Prerequisites: Redundant part (46). Positive examples: See Fig. 11. The second class dictionary is in CNF. 48. Objective: Consolidation of alternatives. Behavior: Given a class dictionary graph in CNF, minimize it while preserving object-equivalence. Prerequisites: Common normal form (47). 49. Objective: Tree property. Behavior: Given a class dictionary graph, determine whether it has the tree-property. If it has the tree property, transform it to an object-equivalent single-inheritance class dictionary graph. Prerequisites: Object equivalence (21). 10

11 A : B C. B : D E. D : F G. F = <g> G. C =. E =. G =. Phases: 0: A, C. 1: B, E. 2: D, G. 3: F. growth complexity: 7/4 Figure 12: Growth plan 50. Objective: Class dictionary graph minimization. Behavior: Given a class dictionary graph, nd a minimal object-equivalent class dictionary graph. Prerequisites: Common normal form (47), Consolidation of alternatives (48). Design 51. Objective: Task identication. Behavior: Given a class module and a specication (initial design or maintenance), nd a list of tasks which need to implemented. Prerequisites: Experience. 52. Objective: Class cooperation and task design. Behavior: Given a class module and a task, nd a task design, consisting of objects, classes, interfaces and their call structure which will be needed to implement the task. Prerequisites: Legal class dictionary (32). 53. Objective: Library objective. Behavior: Given a class dictionary and a specication, decide which library to use (e.g., NIHCL, Interviews, C++ tasks) and select an appropriate group of classes for reuse. Prerequisites: Knowledge of libraries, Legal class dictionary (32). 54. Objective: Growth-plan. Behavior: Given a class dictionary graph and a growth-plan, check whether it is legal and compute the growth-plan complexity. Identify incomplete phases. Give a minimally adequate set of inputs for each phase. Determine whether the growth-plan is top-down. Prerequisites: Legal class dictionary graph (9). Positive examples: See Fig

12 55. Objective: Task growth plan. Behavior: Given a task design, nd a growth plan for implementing it. Prerequisites: Growth-plan (54). 56. Objective: Law of Demeter for functions. Behavior: Given an object-oriented program, decide whether it satises the Law of Demeter for functions. If it does not, rewrite it. Prerequisites: Object-oriented programming language. 57. Objective: Legal propagation pattern. Behavior: Given a class dictionary graph and a propagation pattern, check whether the propagation pattern is legal with respect to the class dictionary graph, and list the vertices which the propagation pattern covers. Prerequisites: Legal class dictionary graph (9). 58. Objective: Propagation pattern abstraction. Behavior: Given a class dictionary graph and a set of vertices, nd a minimal set of propagation patterns which cover the set of vertices. Prerequisites: Legal propagation pattern (57). 59. Objective: Object-oriented design. Behavior: Given a project specication, develop a class dictionary and a list of tasks with their task designs and growth plans. Satisfy the Law of Demeter. Prerequisites: Class dictionary development (44), Library objective (53), Task identication (51), Task growth plan (55), Class cooperation and task design (52), Law of Demeter for functions (56). Programming 60. Objective: Propagation graph. Behavior: Given a legal propagation pattern, write the corresponding propagation graph and the C++ program. Prerequisites: Legal propagation pattern (57). 61. Objective: Application skeleton. Behavior: Write a propagation pattern which denes a C++ program that traverses all subobjects of a given object in pre-order. Prerequisites: Legal propagation pattern (57). 62. Objective: Propagation pattern for counting. Behavior: Write a propagation pattern which counts all subobjects of class A in a given object. Prerequisites: Application skeleton (61). 63. Objective: Propagation pattern development. Behavior: Given a task design, nd a collection of propagation patterns which implement the task. Prerequisites: Propagation pattern abstraction (58), Propagation graph (60), Application skeleton (61). 12

13 64. Objective: Virtual function table. Behavior: Given a single-inheritance class dictionary graph which is decorated with virtual functions at the alternation classes, produce the virtual function tables which are needed for all construction classes which are alternation-reachable from an alternation class with virtual functions. Prerequisites: Legal class dictionary graph (9). 65. Objective: Programming in C++. Behavior: Write a C++ program for a given project specication. Prerequisites: C++, Legal class dictionary graph (9), Legal object graph (27), Object construction (29), Class dictionary graph translation (18), Application skeleton (61), Law of Demeter for functions (56), Virtual function table (64), Growth-plan (54), Object-oriented design (59), Propagation pattern development (63). 66. Objective: Generic Programming. Behavior: Write a C++ program for a function which is dened for all applications, i.e., implement a function which performs some action regardless of the class dictionary used. Prerequisites: Programming in C++ (65). Abstraction Building \higher-level" abstractions from \lower-level" abstractions. 67. Objective: Minimum class dictionary learning. Behavior: Given object example graphs, nd a minimum class dictionary compatible with the object example graphs. Prerequisites: Legal class dictionary graph (9), Class dictionary graph minimization (50). Course specic 68. Objective: Programming language implementation. Behavior: Given a class dictionary for a programming language, implement an interpreter or a compiler for the language. Prerequisites: Scheme, Pascal, C, Prolog, Programming in C++ (65), Developing an application in existing environment (84), Generation (85). 69. Objective: EER diagram to object-oriented program. Behavior: Given an extended entity-relationship diagram, translate its information content into a class dictionary and a C++ constraints checker. Prerequisites: EER. 70. Objective: Data model implementation. Behavior: Given a class dictionary for a data model, implement a schema checker, and a schema compiler. Prerequisites: ER, EER, Relational model, Programming in C++ (65), Developing an application in existing environment (84), Generation (85). 71. Objective: Data model translation. Behavior: Given two class dictionaries for two data models, implement a translator. Prerequisites: Programming in C++ (65), Developing an application in existing environment (84). 13

14 72. Objective: Data model as class dictionary. Behavior: Given a data model denition, write a class dictionary which denes the structure and the language of the data model (for the structures and/or constraints and/or operations). Prerequisites: Class dictionary development (44). Demeter System T M 73. Objective: Setting up your account for Demeter. Behavior: Give the commands to set-up your account to use Demeter. Prerequisites: UNIX. Design 74. Objective: Semantic checking and class dictionary debugging. Behavior: Given a class dictionary, check it for semantic errors and correct it until no errors are reported. Prerequisites: Legal class dictionary (32), Objective: Graphical, textual representation with cross reference information. Behavior: Show the structure of a class dictionary by producing a graphical, textual representation using nesting and cross connection. 76. Objective: Miscelleanous tools. Behavior: Describe how to check a class dictionary for multiple inheritance, how to optimize it, how to compare two cds and how to abstract from two class dictionaries. Using an existing environment 77. Objective: Available functions in generated environment. Behavior: Given a class dictionary, list all the classes and their functions which are available in the generated environment. Prerequisites: Legal class dictionary (32). 78. Objective: Implementation les. Behavior: Given a generated environment, give the directories where you can write your code and describe what kind of code you can put in each le and how you have to name the les. Prerequisites: Legal class dictionary (32), Available functions in generated environment (77). 79. Objective: Propagation. Behavior: Describe how to call the propagation pattern tool. 80. Objective: Interface les. Behavior: Given a class dictionary and a set of C++ function implementations, give the set of generated function interfaces (headers command). Prerequisites: Legal class dictionary (32). 81. Objective: Compilation. Behavior: Give the directory where the compilation command has to be called and give the directory and name of the activated make-le. 14

15 82. Objective: Compilation Error. Behavior: Given a compilation error, how do you nd the le where the error is located. Prerequisites: UNIX, C Objective: Debugging. Behavior: If your program produces a core dump, how do you use the debugger to nd the problem. Prerequisites: Unix, C Objective: Developing an application in existing environment. Behavior: Given a class dictionary and an environment, write application code in the environment. Prerequisites: Legal class dictionary (32), Setting up your account for Demeter (73), Available functions in generated environment (77), Implementation les (78), Interface les (80), Propagation graph (60), Compilation (81), Compilation Error (82), Debugging (83). Generating your own environment 85. Objective: Generation. Behavior: Given a class dictionary, give the commands to generate your own environment. Prerequisites: Semantic checking and class dictionary debugging (74). 86. Objective: Lex. Behavior: Describe where and how to change a lex input le to get the desired scanner after calling the appropriate generation command. The comment denitions, the white space denitions and the terminal set denitions may be changed. Prerequisites: Generation (85). 15

16 2 Horizontal layers The objectives describe what you will learn, but not the order in which you will learn the material. We will take several walks through the objectives from object examples to C++ programming, each time becoming more sophisticated. The horizontal layers can be described by: construction classes only: Object example graph recognition (1), Class dictionary graph graphical representation (6), Class dictionary graph translation (18), Programming in C++ (65), etc. add alternation classes without common parts: objectives 1, 6, 18, 65, etc. add common parts: objectives 1, 6, 18, 65, etc. add syntax: objectives 1, 6, 18, 65, etc. add parameterization: objectives 1, 6, 18, 65, etc. 3 Data modeling The objectives we will cover include the following EER diagram to object-oriented program (69), Data model implementation (70), Data model translation (71), Developing an application in existing environment (84), Generation (85), Data model as class dictionary (72) and all prerequisites of those objectives. Several objectives related to C++ will also be covered. More objectives will be added during the quarter as we read the latest research papers in the eld. 4 Analysis of programming languages The objectives we will cover include Programming language implementation (68) and all prerequisites of this objective. Several objectives related to C++ will also be covered. Course history: 1. lecture: Object example graph recognition, Class dictionary graph recognition, Legal propagation pattern, Class dictionary graph graphical representation, Class dictionary graph textual representation using fruit baskets. 2. lecture: Class dictionary graph translation, Class dictionary graph recognition 3. lecture: Legal class dictionary graph, Partial class dictionary graph, Legal object graph, Class dictionary recognition using list example. 4. lecture: Class dictionary recognition, Legal class dictionary, Printing, Scanning, First sets, Parsing, Bijection motivation for g print, Follow sets, LL(1) conditions. 5. lecture: Compiler and interpreter with propagation patterns, repetition classes, Programming in C++_ 6. lecture: Growth-plan, Task growth plan. 7. lecture: Review of objectives using Scheme class dictionary. 16

17 5 Principles of programming languages The objectives we will cover include Programming language implementation (68) and all prerequisites of this objective. Several objectives related to C++ will also be covered. Course history: 1. lecture: Object example graph recognition, Class dictionary graph recognition, Legal propagation pattern, Class dictionary graph graphical representation, Class dictionary graph textual representation using fruit baskets. Introduction: why object-oriented programming? In the rst 3-hour lecture we cover the rst part of the view graphs: Structures for object-oriented design, plus the beginning of the second part: Object-construction and presentation. 6 Object-oriented systems Course history: 1. lecture: First part (Structures for object-oriented design) completed. In second part: Object construction and presentation (to rst sets). 80 view graphs for three hours. 2. lecture: Object construction and presentation continued. 3. lecture: Style rules for classes, Propagation patterns. 4. lecture: Law of Demeter for functions, transformation to good style. 5. lecture: Propagation patterns revisited, growth plans, evolution of class structures. 7 One-day Tutorial The Programming in C++ objective (65) and all its predecessors will be covered by several \sweeps" through increasingly more complex examples. After enough examples have been seen the essential concepts are dened precisely. 1. hour: From object examples to C++ programs (covers several objectives by giving examples only). 2. hour: Structures for object-oriented design: Legal class dictionary graph (9), Legal object graph (27), Object construction (29), Class dictionary graph translation (18). 3. hour: How to nd classes: abstraction from objects and language design Legal object example graphs (3), Incremental class dictionary graph learning (15), Class dictionary development (44). 4. hour: Style rules for functions: Class cooperation and task design(52), Law of Demeter for functions (56), Legal propagation pattern (57), Growth-plan (54). 5. hour: Style rules for classes: Object equivalence (21), Common normal form (47), Tree property (49). 6. hour: Software reuse and summary of the Demeter design method: Library objective (53), Object-oriented design (59). 17

18 References [LR89] Karl J. Lieberherr and Arthur J. Riel. Contributions to teaching object-oriented design and programming. In Object-Oriented Programming Systems, Languages and Applications Conference, in Special Issue of SIGPLAN Notices, pages 11{22, October

19 Contents 1 Behavioral objectives 1 2 Horizontal layers 16 3 Data modeling 16 4 Analysis of programming languages 16 5 Principles of programming languages 17 6 Object-oriented systems 17 7 One-day Tutorial 17 19

ECE 468/573 Midterm 1 September 30, 2015

ECE 468/573 Midterm 1 September 30, 2015 ECE 468/573 Midterm 1 September 30, 2015 Name: Purdue email: Please sign the following: I affirm that the answers given on this test are mine and mine alone. I did not receive help from any person or material

More information

Final Term Papers 2013

Final Term Papers 2013 Solved by: Sahar (well wisher) Class BSCS 6 th Semester Subject CS606 (COMPILER CONSTRUCTION) Solution Type: Final Term Solved Subjective including Papers of Year : 2013,2012,2011,2010,2009 2006 Institute:

More information

Demeter System Publications. The Demeter Team. c/o Karl J. Lieberherr. Northeastern University, College of Computer Science

Demeter System Publications. The Demeter Team. c/o Karl J. Lieberherr. Northeastern University, College of Computer Science Demeter System Publications The Demeter Team c/o Karl J. Lieberherr Northeastern University, College of Computer Science 125 Cullinane Hall, 360 Huntington Ave., Boston MA 02115 lieber@corwin.ccs.northeastern.edu

More information

CS 132 Compiler Construction, Fall 2012 Instructor: Jens Palsberg Multiple Choice Exam, Nov 6, 2012

CS 132 Compiler Construction, Fall 2012 Instructor: Jens Palsberg Multiple Choice Exam, Nov 6, 2012 CS 132 Compiler Construction, Fall 2012 Instructor: Jens Palsberg Multiple Choice Exam, Nov 6, 2012 ID Name This exam consists of 22 questions. Each question has four options, exactly one of which is correct,

More information

CSCI312 Principles of Programming Languages

CSCI312 Principles of Programming Languages Copyright 2006 The McGraw-Hill Companies, Inc. CSCI312 Principles of Programming Languages! LL Parsing!! Xu Liu Derived from Keith Cooper s COMP 412 at Rice University Recap Copyright 2006 The McGraw-Hill

More information

Note that for recursive descent to work, if A ::= B1 B2 is a grammar rule we need First k (B1) disjoint from First k (B2).

Note that for recursive descent to work, if A ::= B1 B2 is a grammar rule we need First k (B1) disjoint from First k (B2). LL(k) Grammars We need a bunch of terminology. For any terminal string a we write First k (a) is the prefix of a of length k (or all of a if its length is less than k) For any string g of terminal and

More information

Parsing Part II (Top-down parsing, left-recursion removal)

Parsing Part II (Top-down parsing, left-recursion removal) Parsing Part II (Top-down parsing, left-recursion removal) Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Computer Science and Engineering

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Computer Science and Engineering TEST 1 Date : 24 02 2015 Marks : 50 Subject & Code : Compiler Design ( 10CS63) Class : VI CSE A & B Name of faculty : Mrs. Shanthala P.T/ Mrs. Swati Gambhire Time : 8:30 10:00 AM SOLUTION MANUAL 1. a.

More information

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation Language Implementation Methods The Design and Implementation of Programming Languages Compilation Interpretation Hybrid In Text: Chapter 1 2 Compilation Interpretation Translate high-level programs to

More information

Acknowledgments 2

Acknowledgments 2 Program Slicing: An Application of Object-oriented Program Dependency Graphs Anand Krishnaswamy Dept. of Computer Science Clemson University Clemson, SC 29634-1906 anandk@cs.clemson.edu Abstract A considerable

More information

Chapter 3. Parsing #1

Chapter 3. Parsing #1 Chapter 3 Parsing #1 Parser source file get next character scanner get token parser AST token A parser recognizes sequences of tokens according to some grammar and generates Abstract Syntax Trees (ASTs)

More information

Time : 1 Hour Max Marks : 30

Time : 1 Hour Max Marks : 30 Total No. of Questions : 6 P4890 B.E/ Insem.- 74 B.E ( Computer Engg) PRINCIPLES OF MODERN COMPILER DESIGN (2012 Pattern) (Semester I) Time : 1 Hour Max Marks : 30 Q.1 a) Explain need of symbol table with

More information

Week 2: Syntax Specification, Grammars

Week 2: Syntax Specification, Grammars CS320 Principles of Programming Languages Week 2: Syntax Specification, Grammars Jingke Li Portland State University Fall 2017 PSU CS320 Fall 17 Week 2: Syntax Specification, Grammars 1/ 62 Words and Sentences

More information

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis CS 1622 Lecture 2 Lexical Analysis CS 1622 Lecture 2 1 Lecture 2 Review of last lecture and finish up overview The first compiler phase: lexical analysis Reading: Chapter 2 in text (by 1/18) CS 1622 Lecture

More information

Utilizing Behavioral Abstractions to Facilitate Maintenance During Class Evolution

Utilizing Behavioral Abstractions to Facilitate Maintenance During Class Evolution Utilizing Behavioral Abstractions to Facilitate Maintenance During Class Evolution Linda M. Keszenheimer Northeastern University, College of Computer Science Cullinane Hall, 360 Huntington Avenue, Boston

More information

Syntactic Analysis. CS345H: Programming Languages. Lecture 3: Lexical Analysis. Outline. Lexical Analysis. What is a Token? Tokens

Syntactic Analysis. CS345H: Programming Languages. Lecture 3: Lexical Analysis. Outline. Lexical Analysis. What is a Token? Tokens Syntactic Analysis CS45H: Programming Languages Lecture : Lexical Analysis Thomas Dillig Main Question: How to give structure to strings Analogy: Understanding an English sentence First, we separate a

More information

Compilers and Interpreters

Compilers and Interpreters Overview Roadmap Language Translators: Interpreters & Compilers Context of a compiler Phases of a compiler Compiler Construction tools Terminology How related to other CS Goals of a good compiler 1 Compilers

More information

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! [ALSU03] Chapter 3 - Lexical Analysis Sections 3.1-3.4, 3.6-3.7! Reading for next time [ALSU03] Chapter 3 Copyright (c) 2010 Ioanna

More information

Front End. Hwansoo Han

Front End. Hwansoo Han Front nd Hwansoo Han Traditional Two-pass Compiler Source code Front nd IR Back nd Machine code rrors High level functions Recognize legal program, generate correct code (OS & linker can accept) Manage

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

Adaptive Object-Oriented Programming using. Karl J. Lieberherr, Ignacio Silva-Lepe and Cun Xiao. Northeastern University, College of Computer Science

Adaptive Object-Oriented Programming using. Karl J. Lieberherr, Ignacio Silva-Lepe and Cun Xiao. Northeastern University, College of Computer Science Adaptive Object-Oriented Programming using Graph-Based Customization Karl J. Lieberherr, Ignacio Silva-Lepe and Cun Xiao Northeastern University, College of Computer Science Cullinane Hall, Boston MA 02115

More information

UNIT I INTRODUCTION TO COMPILER 1. What is a Complier? A Complier is a program that reads a program written in one language-the source language-and translates it in to an equivalent program in another

More information

Contents. Chapter 1 SPECIFYING SYNTAX 1

Contents. Chapter 1 SPECIFYING SYNTAX 1 Contents Chapter 1 SPECIFYING SYNTAX 1 1.1 GRAMMARS AND BNF 2 Context-Free Grammars 4 Context-Sensitive Grammars 8 Exercises 8 1.2 THE PROGRAMMING LANGUAGE WREN 10 Ambiguity 12 Context Constraints in Wren

More information

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department 0901212 Python Programming 1 st Semester 2014/2015 Course Catalog This course introduces

More information

Assignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4

Assignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4 Overview This assignment combines several dierent data abstractions and algorithms that we have covered in class, including priority queues, on-line disjoint set operations, hashing, and sorting. The project

More information

DAJ User's Guide. by John J. Sung. Introduction. Installation. Requirements. Downloading and unpacking DAJ

DAJ User's Guide. by John J. Sung. Introduction. Installation. Requirements. Downloading and unpacking DAJ DAJ User's Guide by John J. Sung Introduction The integration between AspectJ and Demeter concepts came about as my Master's Thesis topic. We wanted to gain a better understanding of how the concepts applied

More information

CS Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0

CS Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0 SYL-410-2014C CS 410 - Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0 Course location: 107 ERB, Evansdale Campus Course times: Tuesdays and Thursdays, 2:00-3:15 Course

More information

Abstract Syntax Trees & Top-Down Parsing

Abstract Syntax Trees & Top-Down Parsing Abstract Syntax Trees & Top-Down Parsing Review of Parsing Given a language L(G), a parser consumes a sequence of tokens s and produces a parse tree Issues: How do we recognize that s L(G)? A parse tree

More information

Abstract Syntax Trees & Top-Down Parsing

Abstract Syntax Trees & Top-Down Parsing Review of Parsing Abstract Syntax Trees & Top-Down Parsing Given a language L(G), a parser consumes a sequence of tokens s and produces a parse tree Issues: How do we recognize that s L(G)? A parse tree

More information

Abstract Syntax Trees & Top-Down Parsing

Abstract Syntax Trees & Top-Down Parsing Review of Parsing Abstract Syntax Trees & Top-Down Parsing Given a language L(G), a parser consumes a sequence of tokens s and produces a parse tree Issues: How do we recognize that s L(G)? A parse tree

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 5: Syntax Analysis (Parsing) Zheng (Eddy) Zhang Rutgers University January 31, 2018 Class Information Homework 1 is being graded now. The sample solution

More information

UNIT -2 LEXICAL ANALYSIS

UNIT -2 LEXICAL ANALYSIS OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 2: Syntax Analysis Zheng (Eddy) Zhang Rutgers University January 22, 2018 Announcement First recitation starts this Wednesday Homework 1 will be release

More information

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10 Mathematics/Science Department Kirkwood Community College Course Syllabus Computer Science CSC142 Bob Driggs Dean Cate Sheller Instructor 1/10 Computer Science (CSC142) Course Description Introduces computer

More information

COMPILER DESIGN LECTURE NOTES

COMPILER DESIGN LECTURE NOTES COMPILER DESIGN LECTURE NOTES UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing:

More information

Construction of Application Generators Using Eli. Uwe Kastens, University of Paderborn, FRG. Abstract

Construction of Application Generators Using Eli. Uwe Kastens, University of Paderborn, FRG. Abstract Construction of Application Generators Using Eli Uwe Kastens, University of Paderborn, FRG Abstract Application generators are a powerful means for reuse of software design. They produce special purpose

More information

EECS483 D1: Project 1 Overview

EECS483 D1: Project 1 Overview EECS483 D1: Project 1 Overview Chun-Hung Hsiao Jan 11, 2013 Special thanks to Ashutosh 1 Course Websites http://www.eecs.umich.edu/courses/eecs483/ Schedule, lecture slides https://piazza.com/class#winter2013/

More information

A simple syntax-directed

A simple syntax-directed Syntax-directed is a grammaroriented compiling technique Programming languages: Syntax: what its programs look like? Semantic: what its programs mean? 1 A simple syntax-directed Lexical Syntax Character

More information

Grammars and Parsing. Paul Klint. Grammars and Parsing

Grammars and Parsing. Paul Klint. Grammars and Parsing Paul Klint Grammars and Languages are one of the most established areas of Natural Language Processing and Computer Science 2 N. Chomsky, Aspects of the theory of syntax, 1965 3 A Language...... is a (possibly

More information

Syntax Analysis, III Comp 412

Syntax Analysis, III Comp 412 Updated algorithm for removal of indirect left recursion to match EaC3e (3/2018) COMP 412 FALL 2018 Midterm Exam: Thursday October 18, 7PM Herzstein Amphitheater Syntax Analysis, III Comp 412 source code

More information

CJT^jL rafting Cm ompiler

CJT^jL rafting Cm ompiler CJT^jL rafting Cm ompiler ij CHARLES N. FISCHER Computer Sciences University of Wisconsin Madison RON K. CYTRON Computer Science and Engineering Washington University RICHARD J. LeBLANC, Jr. Computer Science

More information

PROBLEM 1 : (Vocabulary: 8 points) For each of the words/phrases below, circle the denition that is the best description as it pertains in the context

PROBLEM 1 : (Vocabulary: 8 points) For each of the words/phrases below, circle the denition that is the best description as it pertains in the context Test 1: CPS 100 Owen Astrachan October 5, 1994 Name: Honor code acknowledgement (signature) Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 TOTAL: value 8 pts. 6 pts. 14 pts. 10 pts. 14 pts. 52 pts.

More information

Compilers. Yannis Smaragdakis, U. Athens (original slides by Sam

Compilers. Yannis Smaragdakis, U. Athens (original slides by Sam Compilers Parsing Yannis Smaragdakis, U. Athens (original slides by Sam Guyer@Tufts) Next step text chars Lexical analyzer tokens Parser IR Errors Parsing: Organize tokens into sentences Do tokens conform

More information

Compiling Regular Expressions COMP360

Compiling Regular Expressions COMP360 Compiling Regular Expressions COMP360 Logic is the beginning of wisdom, not the end. Leonard Nimoy Compiler s Purpose The compiler converts the program source code into a form that can be executed by the

More information

Lexical Analysis. COMP 524, Spring 2014 Bryan Ward

Lexical Analysis. COMP 524, Spring 2014 Bryan Ward Lexical Analysis COMP 524, Spring 2014 Bryan Ward Based in part on slides and notes by J. Erickson, S. Krishnan, B. Brandenburg, S. Olivier, A. Block and others The Big Picture Character Stream Scanner

More information

Single-pass Static Semantic Check for Efficient Translation in YAPL

Single-pass Static Semantic Check for Efficient Translation in YAPL Single-pass Static Semantic Check for Efficient Translation in YAPL Zafiris Karaiskos, Panajotis Katsaros and Constantine Lazos Department of Informatics, Aristotle University Thessaloniki, 54124, Greece

More information

CS 406/534 Compiler Construction Putting It All Together

CS 406/534 Compiler Construction Putting It All Together CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy

More information

Static Semantics. Lecture 15. (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1

Static Semantics. Lecture 15. (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1 Static Semantics Lecture 15 (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1 Current Status Lexical analysis Produces tokens Detects & eliminates illegal tokens Parsing

More information

a name refers to an object side effect of assigning composite objects

a name refers to an object side effect of assigning composite objects Outline 1 Formal Languages syntax and semantics Backus-Naur Form 2 Strings, Lists, and Tuples composite data types building data structures the % operator 3 Shared References a name refers to an object

More information

Natural Semantics [14] within the Centaur system [6], and the Typol formalism [8] which provides us with executable specications. The outcome of such

Natural Semantics [14] within the Centaur system [6], and the Typol formalism [8] which provides us with executable specications. The outcome of such A Formal Executable Semantics for Java Isabelle Attali, Denis Caromel, Marjorie Russo INRIA Sophia Antipolis, CNRS - I3S - Univ. Nice Sophia Antipolis, BP 93, 06902 Sophia Antipolis Cedex - France tel:

More information

Syntax Errors; Static Semantics

Syntax Errors; Static Semantics Dealing with Syntax Errors Syntax Errors; Static Semantics Lecture 14 (from notes by R. Bodik) One purpose of the parser is to filter out errors that show up in parsing Later stages should not have to

More information

Syntax Analysis, III Comp 412

Syntax Analysis, III Comp 412 COMP 412 FALL 2017 Syntax Analysis, III Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2017, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp

More information

Browsing in the tsimmis System. Stanford University. into requests the source can execute. The data returned by the source is converted back into the

Browsing in the tsimmis System. Stanford University. into requests the source can execute. The data returned by the source is converted back into the Information Translation, Mediation, and Mosaic-Based Browsing in the tsimmis System SIGMOD Demo Proposal (nal version) Joachim Hammer, Hector Garcia-Molina, Kelly Ireland, Yannis Papakonstantinou, Jerey

More information

Top down vs. bottom up parsing

Top down vs. bottom up parsing Parsing A grammar describes the strings that are syntactically legal A recogniser simply accepts or rejects strings A generator produces sentences in the language described by the grammar A parser constructs

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08 CS412/413 Introduction to Compilers Tim Teitelbaum Lecture 2: Lexical Analysis 23 Jan 08 Outline Review compiler structure What is lexical analysis? Writing a lexer Specifying tokens: regular expressions

More information

Jim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 2

Jim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 2 Jim Lambers ENERGY 211 / CME 211 Autumn Quarter 2007-08 Programming Project 2 This project is due at 11:59pm on Friday, October 17. 1 Introduction In this project, you will implement functions in order

More information

Introduction to Lexical Analysis

Introduction to Lexical Analysis Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexers Regular expressions Examples

More information

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013 Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 1 Tuesday, January 29, 2013 1 Intro to semantics What is the meaning of a program? When we write a program, we use

More information

Building a Parser III. CS164 3:30-5:00 TT 10 Evans. Prof. Bodik CS 164 Lecture 6 1

Building a Parser III. CS164 3:30-5:00 TT 10 Evans. Prof. Bodik CS 164 Lecture 6 1 Building a Parser III CS164 3:30-5:00 TT 10 Evans 1 Overview Finish recursive descent parser when it breaks down and how to fix it eliminating left recursion reordering productions Predictive parsers (aka

More information

Parsing. Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice.

Parsing. Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice. Parsing Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. Students

More information

CS5363 Final Review. cs5363 1

CS5363 Final Review. cs5363 1 CS5363 Final Review cs5363 1 Programming language implementation Programming languages Tools for describing data and algorithms Instructing machines what to do Communicate between computers and programmers

More information

Parsing II Top-down parsing. Comp 412

Parsing II Top-down parsing. Comp 412 COMP 412 FALL 2018 Parsing II Top-down parsing Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled

More information

Chapter 3 (part 3) Describing Syntax and Semantics

Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings

More information

Recursive Descent Parsers

Recursive Descent Parsers Recursive Descent Parsers Lecture 7 Robb T. Koether Hampden-Sydney College Wed, Jan 28, 2015 Robb T. Koether (Hampden-Sydney College) Recursive Descent Parsers Wed, Jan 28, 2015 1 / 18 1 Parsing 2 LL Parsers

More information

Inter-Project Dependencies in Java Software Ecosystems

Inter-Project Dependencies in Java Software Ecosystems Inter-Project Dependencies Inter-Project Dependencies in Java Software Ecosystems in Java Software Ecosystems Antonín Procházka 1, Mircea Lungu 2, Karel Richta 3 Antonín Procházka 1, Mircea Lungu 2, Karel

More information

Brouillon d'article pour les Cahiers GUTenberg n?? February 5, xndy A Flexible Indexing System Roger Kehr Institut fur Theoretische Informatik

Brouillon d'article pour les Cahiers GUTenberg n?? February 5, xndy A Flexible Indexing System Roger Kehr Institut fur Theoretische Informatik Brouillon d'article pour les Cahiers GUTenberg n?? February 5, 1998 1 xndy A Flexible Indexing System Roger Kehr Institut fur Theoretische Informatik Darmstadt University of Technology Wilhelminenstrae

More information

Revisit the example. Transformed DFA 10/1/16 A B C D E. Start

Revisit the example. Transformed DFA 10/1/16 A B C D E. Start Revisit the example ε 0 ε 1 Start ε a ε 2 3 ε b ε 4 5 ε a b b 6 7 8 9 10 ε-closure(0)={0, 1, 2, 4, 7} = A Trans(A, a) = {1, 2, 3, 4, 6, 7, 8} = B Trans(A, b) = {1, 2, 4, 5, 6, 7} = C Trans(B, a) = {1,

More information

8 Parsing. Parsing. Top Down Parsing Methods. Parsing complexity. Top down vs. bottom up parsing. Top down vs. bottom up parsing

8 Parsing. Parsing. Top Down Parsing Methods. Parsing complexity. Top down vs. bottom up parsing. Top down vs. bottom up parsing 8 Parsing Parsing A grammar describes syntactically legal strings in a language A recogniser simply accepts or rejects strings A generator produces strings A parser constructs a parse tree for a string

More information

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations Outline Computer Science 331 Data Structures, Abstract Data Types, and Their Implementations Mike Jacobson 1 Overview 2 ADTs as Interfaces Department of Computer Science University of Calgary Lecture #8

More information

Abstract Syntax Trees L3 24

Abstract Syntax Trees L3 24 Abstract Syntax Trees L3 24 Formal languages An extensional view of what constitutes a formal language is that it is completely determined by the set of words in the dictionary : Given an alphabet Σ, wecallanysubsetofσ

More information

COP4020 Spring 2011 Midterm Exam

COP4020 Spring 2011 Midterm Exam COP4020 Spring 2011 Midterm Exam Name: (Please print Put the answers on these sheets. Use additional sheets when necessary or write on the back. Show how you derived your answer (this is required for full

More information

Syntactic Analysis. Top-Down Parsing

Syntactic Analysis. Top-Down Parsing Syntactic Analysis Top-Down Parsing Copyright 2017, Pedro C. Diniz, all rights reserved. Students enrolled in Compilers class at University of Southern California (USC) have explicit permission to make

More information

Lexical Analysis (ASU Ch 3, Fig 3.1)

Lexical Analysis (ASU Ch 3, Fig 3.1) Lexical Analysis (ASU Ch 3, Fig 3.1) Implementation by hand automatically ((F)Lex) Lex generates a finite automaton recogniser uses regular expressions Tasks remove white space (ws) display source program

More information

Top-Down Parsing and Intro to Bottom-Up Parsing. Lecture 7

Top-Down Parsing and Intro to Bottom-Up Parsing. Lecture 7 Top-Down Parsing and Intro to Bottom-Up Parsing Lecture 7 1 Predictive Parsers Like recursive-descent but parser can predict which production to use Predictive parsers are never wrong Always able to guess

More information

Introduction to Lexical Analysis

Introduction to Lexical Analysis Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexical analyzers (lexers) Regular

More information

CS 4201 Compilers 2014/2015 Handout: Lab 1

CS 4201 Compilers 2014/2015 Handout: Lab 1 CS 4201 Compilers 2014/2015 Handout: Lab 1 Lab Content: - What is compiler? - What is compilation? - Features of compiler - Compiler structure - Phases of compiler - Programs related to compilers - Some

More information

Lexical Analysis. Introduction

Lexical Analysis. Introduction Lexical Analysis Introduction Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission to make copies

More information

Compilers for Modern Architectures Course Syllabus, Spring 2015

Compilers for Modern Architectures Course Syllabus, Spring 2015 Compilers for Modern Architectures Course Syllabus, Spring 2015 Instructor: Dr. Rafael Ubal Email: ubal@ece.neu.edu Office: 140 The Fenway, 3rd floor (see detailed directions below) Phone: 617-373-3895

More information

for Structured Documents in SYNDOC environment Eila Kuikka, Jouni Mykkanen Arto Ryynanen, Airi Salminen Report A

for Structured Documents in SYNDOC environment Eila Kuikka, Jouni Mykkanen Arto Ryynanen, Airi Salminen Report A UNIVERSITY OF JOENSUU DEPARTMENT OF COMPUTER SCIENCE Report Series A Implementation of Two-Dimensional Filters for Structured Documents in SYNDOC environment Eila Kuikka, Jouni Mykkanen Arto Ryynanen,

More information

Course introduction. Advanced Compiler Construction Michel Schinz

Course introduction. Advanced Compiler Construction Michel Schinz Course introduction Advanced Compiler Construction Michel Schinz 2016 02 25 General information Course goals The goal of this course is to teach you: how to compile high-level functional and objectoriented

More information

INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM

INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM Charles S. Saxon, Eastern Michigan University, charles.saxon@emich.edu ABSTRACT Incorporating advanced programming

More information

Null space basis: mxz. zxz I

Null space basis: mxz. zxz I Loop Transformations Linear Locality Enhancement for ache performance can be improved by tiling and permutation Permutation of perfectly nested loop can be modeled as a matrix of the loop nest. dependence

More information

2068 (I) Attempt all questions.

2068 (I) Attempt all questions. 2068 (I) 1. What do you mean by compiler? How source program analyzed? Explain in brief. 2. Discuss the role of symbol table in compiler design. 3. Convert the regular expression 0 + (1 + 0)* 00 first

More information

SML Style Guide. Last Revised: 31st August 2011

SML Style Guide. Last Revised: 31st August 2011 SML Style Guide Last Revised: 31st August 2011 It is an old observation that the best writers sometimes disregard the rules of rhetoric. When they do so, however, the reader will usually find in the sentence

More information

Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES ( ) (ODD) Code Optimization

Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES ( ) (ODD) Code Optimization Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES (2018-19) (ODD) Code Optimization Prof. Jonita Roman Date: 30/06/2018 Time: 9:45 to 10:45 Venue: MCA

More information

MIDTERM EXAM (Solutions)

MIDTERM EXAM (Solutions) MIDTERM EXAM (Solutions) Total Score: 100, Max. Score: 83, Min. Score: 26, Avg. Score: 57.3 1. (10 pts.) List all major categories of programming languages, outline their definitive characteristics and

More information

Parsing. Roadmap. > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing

Parsing. Roadmap. > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing Roadmap > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing The role of the parser > performs context-free syntax analysis > guides

More information

CIS 130 Exam #2 Review Suggestions

CIS 130 Exam #2 Review Suggestions CIS 130 - Exam #2 Review Suggestions p. 1 * last modified: 11-11-05, 12:32 am CIS 130 Exam #2 Review Suggestions * remember: YOU ARE RESPONSIBLE for course reading, lectures/labs, and especially anything

More information

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics The Compositional C++ Language Denition Peter Carlin Mani Chandy Carl Kesselman March 12, 1993 Revision 0.95 3/12/93, Comments welcome. Abstract This document gives a concise denition of the syntax and

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

Review. Pat Morin COMP 3002

Review. Pat Morin COMP 3002 Review Pat Morin COMP 3002 What is a Compiler A compiler translates from a source language S to a target language T while preserving the meaning of the input 2 Structure of a Compiler program text syntactic

More information

Basic Python 3 Programming (Theory & Practical)

Basic Python 3 Programming (Theory & Practical) Basic Python 3 Programming (Theory & Practical) Length Delivery Method : 5 Days : Instructor-led (Classroom) Course Overview This Python 3 Programming training leads the student from the basics of writing

More information

Syntax/semantics. Program <> program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing

Syntax/semantics. Program <> program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing Syntax/semantics Program program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing Meta-models 8/27/10 1 Program program execution Syntax Semantics

More information

Foundations of object orientation

Foundations of object orientation Foreword Preface List of projects discussed in detail in this book Acknowledgments Part 1 Chapter 1 Chapter 2 Foundations of object orientation Objects and classes 1.1 Objects and classes 1.2 Creating

More information

SLIDE 2. At the beginning of the lecture, we answer question: On what platform the system will work when discussing this subject?

SLIDE 2. At the beginning of the lecture, we answer question: On what platform the system will work when discussing this subject? SLIDE 2 At the beginning of the lecture, we answer question: On what platform the system will work when discussing this subject? We have two systems: Widnows and Linux. The easiest solution is to use the

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

Reverse Engineering with a CASE Tool. Bret Johnson. Research advisors: Spencer Rugaber and Rich LeBlanc. October 6, Abstract

Reverse Engineering with a CASE Tool. Bret Johnson. Research advisors: Spencer Rugaber and Rich LeBlanc. October 6, Abstract Reverse Engineering with a CASE Tool Bret Johnson Research advisors: Spencer Rugaber and Rich LeBlanc October 6, 994 Abstract We examine using a CASE tool, Interactive Development Environment's Software

More information

Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT

Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT Karl Trygve Kalleberg 1 Department of Informatics, University of Bergen, P.O. Box 7800, N-5020 BERGEN,

More information