David Hughes Mark Liu William Liu Moses Nakamura Stephanie Ng.

Slides:



Advertisements
Similar presentations
4b Lexical analysis Finite Automata
Advertisements

1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Chapter 7: User-Defined Functions II Instructor: Mohammad Mojaddam.
INF 212 ANALYSIS OF PROG. LANGS Type Systems Instructors: Crista Lopes Copyright © Instructors.
Classes and Objects: Recap A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
1 Lecture 4 Topics –Problem solving Subroutine Theme –REC language class The class of solvable problems Closure properties.
Road Map Introduction to object oriented programming. Classes
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
1 The scanning process Main goal: recognize words/tokens Snapshot: At any point in time, the scanner has read some input and is on the way to identifying.
Exceptions in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Classes and Objects  A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
Terms and Rules Professor Evan Korth New York University (All rights reserved)
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Chapter 2 A Simple Compiler
AP Computer Science.  Not necessary but good programming practice in Java  When you override a super class method notation.
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
Overview of program analysis Mooly Sagiv html://
ECE122 L17: Method Development and Testing April 5, 2007 ECE 122 Engineering Problem Solving with Java Lecture 17 Method Development and Testing.
CHAPTER 10 Recursion. 2 Recursive Thinking Recursion is a programming technique in which a method can call itself to solve a problem A recursive definition.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
The Center for Advanced Research In Software Engineering (ARISE) The University of Texas at Austin Reengineering of Large-Scale Polylingual Systems Mark.
Secure Web Applications via Automatic Partitioning Stephen Chong, Jed Liu, Andrew C. Meyers, Xin Qi, K. Vikram, Lantian Zheng, Xin Zheng. Cornell University.
Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
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.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
1 A Static Analysis Approach for Automatically Generating Test Cases for Web Applications Presented by: Beverly Leung Fahim Rahman.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
{ Graphite Grigory Arashkovich, Anuj Khanna, Anirban Gangopadhyay, Michael D’Egidio, Laura Willson.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition, Fifth Edition Chapter 7: User-Defined Functions II.
Final Exam Review Closed book Closed laptop One sheet of notes permitted SE-0010 Dr. Mark L. Hornick 1.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
Chapter 8 Chapter 8 Control Structures. Control Structures  A control structure is a control statement and the statements whose execution it controls.
Introduction to Computer Programming
Chapter 14 Abstract Classes and Interfaces. Abstract Classes An abstract class extracts common features and functionality of a family of objects An abstract.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 1 Ahmed Ezzat.
Arrays Chap. 9 Storing Collections of Values 1. Introductory Example Problem: Teachers need to be able to compute a variety of grading statistics for.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Paul Ammann & Jeff Offutt
Chapter 7: User-Defined Functions II
Control Flow Testing Handouts
Lexical analysis Finite Automata
Java Programming: Guided Learning with Early Objects
More About Objects and Methods
Outline of the Chapter Basic Idea Outline of Control Flow Testing
User-Defined Functions
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
HW05: Graphs and Shortest Paths
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Java Programming Language
Implementing Non-Static Features
1) C program development 2) Selection structure
4b Lexical analysis Finite Automata
Parsing Costas Busch - LSU.
Anatomy of a Java Program
4b Lexical analysis Finite Automata
Presentation transcript:

David Hughes Mark Liu William Liu Moses Nakamura Stephanie Ng

Mark Liu, Language Guru

 Initial idea  Language to create and solve min-cost flow graphs

 A network of nodes are connected by arcs.  Each node demands a certain number of units of a good.  Each arc defines a cost of shipping units between nodes.  Which paths should we use to ship goods to satisfy all demand and minimize cost?

 Our language should be able to do two things: 1.Declare a graph (Grapher) 2.Compute a result about the graph (Solver)

 A user defines a Graph using the Grapher language  Another user defines an algorithm to solve a general class of graph problems using the Solver language

 Specify graphs without knowing what they look like a priori  One solver can be used on multiple different graphs

David Hughes, System Integrator

 The typedef is a “handshake”.  The typedef is an agreement between the Graph and Solver files about the structure of each Node and Arc, and which Nodes will be labeled.

 Flow.java is the Compiler driver.  Flow.java looks at the Solver and Graph files, determines their file type, and invokes the appropriate parser.  The Solver and Graph parsers invoke the typedef parser.  The Graph and Solver are converted to Java files.

 Node and Arc construction takes place in the constructor of the Graph file.  Label Nodes have accessors in Graph.java.  All code outside of function definitions appears in the main method of Solver.java.  Function definitions appear as static methods.  The first line of Solver.java instantiates a Graph object.

Stephanie Ng, Project Manager

 DFA simulation  Language: all string’s of a’s and b’s with an even number of both a’s and b’s

 //Each state node has two attributes  Node state(string value, int isAccepting) START; //START is a required node label  //Each path arc has one attribute  Arc path(string symbol);

 //Specify the typedef  use 'Even.flowt';  //Building the graph  "s0", 1; //state s0 is labeled as the START state "s1", 0; "s2", 0; "s3", 0;  //Path definition  s0 -> s1 "a";  s1 -> s0 "a";  s1 -> s2 "b";  s2 -> s1 "b";  s2 -> s3 "a";  s3 -> s2 "a";  s3 -> s0 "b";  s0 -> s3 "b"; s1 s0 START s3s2 a a a a b b b b

 List of string input = ["a","a","b","a","b","b","a","a","b"];  int truth = 0;  if (simulate(input)) {  truth = 1;  print "Input is accepted.\n";  }  if (truth == 0) {  print "Input is not accepted.\n";  }

 int simulate(List of string input) {  Node current = Graph.START;  int i = 0;  while(i < input.length) {  List of Arc pathLst;  pathLst = current.arcsOut;  Arc next = pathLst[0];

 int j = 0;  while(j < pathLst.length) {  Arc connected = pathLst[j];  if(connected.symbol == input[i]) {  next = connected;  print "Went to the next edge.";  }  j = j+1;  }

 int isNext = 0;  if (next) {  isNext = 1;  print "Navigating to the node at the end of that edge.";  current = next.to;  }  if (isNext == 0) {  print "There was a problem. Now exiting.";  return 0;  }  i = i + 1;  }

 if (current.isAccepting) {  return 1;  }  return 0;

William Liu, System Tester

 Unified compiler  Separate compilation for each file type  Compiled into a Java executable

 Version control: Git  Change management  Objective based branches

Moses Nakamura, System Architect

 The grapher and the solver had different grammars  Lesson learned: if you need to duplicate code, find some way of getting around it.  Better way: parser generator

 Functions cannot contain other functions in java, so we had to have special function statement lists  Functions have other weird properties, like return statements...

 Functions must have a correct return statement, so ensuring that we have a correct return statement and that it is properly typed is critical  Solution: do them simultaneously!  Step 1: check that the list and the new element have the same type.  Step 2: if one or both types is null  Step 3: list is null  Step 4: If they have different types and neither is null, reject!  Step 5: final checking

Moses Nakamura, System Architect

 Actually, we managed to use all of the same code generation for graphing and solving!

 We had to use reflection in the AST, but also in the code generation  Truthy vs falsey  Integers instead of booleans  e.g. enables if (arc) instead of if(arc != null)