MDraw Graphics Manipulation Language Huimin Sun(hs2740) Dongxiang Yan(dy2224) Jingyu Shi (js4151) COMS 4115 Columbia University August 16, 2013.

Slides:



Advertisements
Similar presentations
CPSC 388 – Compiler Design and Construction
Advertisements

Introduction To Compilers And Phase 1 Inside a compiler. Inside a C-- compiler. The compilation process. Example C-- code. Extended Backus-Naur.
Control Flow Analysis (Chapter 7) Mooly Sagiv (with Contributions by Hanne Riis Nielson)
1 JavaCUP JavaCUP (Construct Useful Parser) is a parser generator Produce a parser written in java, itself is also written in Java; There are many parser.
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
9/27/2006Prof. Hilfinger, Lecture 141 Syntax-Directed Translation Lecture 14 (adapted from slides by R. Bodik)
Environments and Evaluation
College of Computer Science & Technology Compiler Construction Principles & Implementation Techniques -1- Compiler Construction Principles & Implementation.
Syntax Analysis (Chapter 4) 1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture.
Compiler design Computer Science Rensselaer Polytechnic Lecture 1.
ANTLR with ASTs. Abstract Syntax Trees ANTLR can be instructed to produce ASTs for the output of the parser ANTLR uses a prefix notation for representing.
ANTLR.
CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.
ICS611 Introduction to Compilers Set 1. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Prof. Bodik CS 164 Lecture 51 Building a Parser I CS164 3:30-5:00 TT 10 Evans.
INTRODUCTION TO COMPUTING CHAPTER NO. 06. Compilers and Language Translation Introduction The Compilation Process Phase 1 – Lexical Analysis Phase 2 –
COP4020 Programming Languages
1 Week 4 Questions / Concerns Comments about Lab1 What’s due: Lab1 check off this week (see schedule) Homework #3 due Wednesday (Define grammar for your.
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 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
LANGUAGE TRANSLATORS: WEEK 24 TRANSLATION TO ‘INTERMEDIATE’ CODE (overview) Labs this week: Tutorial Exercises on Code Generation.
Java Classes Using Java Classes Introduction to UML.
Language Translators - Lee McCluskey LANGUAGE TRANSLATORS: WEEK 21 LECTURE: Using JavaCup to create simple interpreters
Java Programming Introduction & Concepts. Introduction to Java Developed at Sun Microsystems by James Gosling in 1991 Object Oriented Free Compiled and.
CSC 338: Compiler design and implementation
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
1 Semantic Analysis Aaron Bloomfield CS 415 Fall 2005.
Lexical Analysis - An Introduction. The Front End The purpose of the front end is to deal with the input language Perform a membership test: code  source.
1 Top Down Parsing. CS 412/413 Spring 2008Introduction to Compilers2 Outline Top-down parsing SLL(1) grammars Transforming a grammar into SLL(1) form.
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
D. M. Akbar Hussain: Department of Software & Media Technology 1 Compiler is tool: which translate notations from one system to another, usually from source.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
BUILD ON THE POLYGLOT COMPILER FRAMEWORK MIHAL BRUMBULLI 7th Workshop “SEERE” Montenegro-Risan 9-14 September 2007 SimJ Programming Language.
CS453 LectureIntroduction1 CS453 Compiler Construction Instructor:Wim Bohm Computer Science Building 470 TA: tba
1 Compiler 3.2 A Level computing. 2 So, Sir what is a compiler?
Parse & Syntax Trees Syntax & Semantic Errors Mini-Lecture.
CPS 506 Comparative Programming Languages Syntax Specification.
Compiler design Lecture 1: Compiler Overview Sulaimany University 2 Oct
PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Introduction Lecture 1 Wed, Jan 12, The Stages of Compilation Lexical analysis. Syntactic analysis. Semantic analysis. Intermediate code generation.
INTRODUCTION TO COMPILERS(cond….) Prepared By: Mayank Varshney(04CS3019)
Compiler Construction By: Muhammad Nadeem Edited By: M. Bilal Qureshi.
The Model of Compilation Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
CS453 LectureIntroduction1 CS453 Compiler Construction Original Design: Michelle Strout Instructor:Wim Bohm
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
CPSC 388 – Compiler Design and Construction Parsers – Syntax Directed Translation.
LECTURE 3 Compiler Phases. COMPILER PHASES Compilation of a program proceeds through a fixed series of phases.  Each phase uses an (intermediate) form.
Language Implementation Overview John Keyser Spring 2016.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
©SoftMoore ConsultingSlide 1 Lexical Analysis (a.k.a. Scanning)
CS 3304 Comparative Languages
CSc 453 Lexical Analysis (Scanning)
PROGRAMMING LANGUAGES
CS 536 / Fall 2017 Introduction to programming languages and compilers
Java Programming: From Problem Analysis to Program Design, 4e
Basic Program Analysis: AST
Chapter 2: Basic Elements of Java
Lecture 15 (Notes by P. N. Hilfinger and R. Bodik)
CSE401 Introduction to Compiler Construction
Syntax-Directed Translation
Designing a Predictive Parser
Chapter 10: Compilers and Language Translation
Course Overview PART I: overview material PART II: inside a compiler
Presentation transcript:

MDraw Graphics Manipulation Language Huimin Sun(hs2740) Dongxiang Yan(dy2224) Jingyu Shi (js4151) COMS 4115 Columbia University August 16, 2013

Introduction 1. A C-like language designed specially for drawing graphics 2. Built-in types: Point, Line, Ellipse, Curve and others 3. Mdraw is easy to learn and to use Functionality: 1. Basic calculation, basic control flow 2. Drawing graphics using point, line, ellipse, and curve

Tutorial Examples How to manipulate these built-in types and functions: Point p1; p1 = Mpoint( x, y ); /* 2 parameter as the coordinate of the point*/ Line l1; l1 = Mline(x1, y1, x2, y2); /* the coordinates of the 2 end point*/ Curve c1; c1 = Mcurve(x, y, w, h, angst, angExt); /*parameters as location, size, angular extents*/ Ellipse e1; e1 = Mellipse( x, y, w, h ); e1.draw(); p1.draw(); c1.draw();

Tutorial Examples void basic(){ if(1<2){ print “This is the start!”; } void paint(){ Ellipse e1; int i; for(i=0; i<20;i=i+1){ e1 = MEllipse(100-5*i, *i, *i, 30+5*i); e1.draw(); } Ellipse e2; for (i=0;i<20;i=i+1){ e2 = MEllipse(5+5*i, 290+i*10, *i,125-5*i); e2.draw(); } This is a.mdraw file. In basic(), it covers the basic Functionalities. paint() is a drawing function. This file draws a pottery.

Examples

Implementation Project Management Architecture

Project Management Scrum methodology 6 weeks Milestones 3 questions

Project Timeline

Architecture

Scanner The scanner is used to tokenize the input source code by using lexical analysis. Comments, whitespace and other unnecessary tokens will be waived. If any, Illegal characters will fail the program. Ocamllex

Architecture Parser From the stream of tokens output from the scanner, the parser generates the AST (abstract syntax tree). Ocamlyacc Translate The translate is designed to do semantic checking The semantic check evaluates the type of a statement. Exceptions will be thrown.

Architecture Java Generator Compile.ml Translate a program in AST form into a java program. Throw an exception if something is wrong, e.g., a reference to an unknown variable or function

Test Scanner Ast

Test void basic(){ print (2+3); }

Scanner VOID ID: basic LEFT_PAREN RIGHT_PAREN LEFT_BRACE PRINT LEFT_PAREN INTLITERAL: 2 PLUS INTLITERAL: 3 RIGHT_PAREN SEMICOLON RIGHT_BRACE

AST PROGRAM:[LIST:[CONSTRUCT_FUNCDEF:[FUNCDECL:[FUNTYPE[ TYPE_VOID],FUNNAME[basic],LIST:[],LIST:[STMT_BLOCK:[LIST:[S TMT_PRINT:[EXPR_BINOP:[EXPR_LITERAL:[LITERAL_INT:[2]],ADD,EXPR_LITERAL:[LITERAL_INT:[3]]]]]]]]]]]

Test Print If For While Arithmetic Gcd Fib Point Line Curve Ellipse

While Test void basic(){ int i; i=10; while(i>0){print i; i=i-1;} } Result:

Gcd Test int gcd(int a, int b) { while (a != b) { if (a > b) a = a - b; else b = b - a; } return a; } void basic() { print(gcd(2,14)); print(gcd(3,15)); print(gcd(99,121)); } Result: