PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.

Slides:



Advertisements
Similar presentations
Lesson 6 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
Advertisements

CPSC 388 – Compiler Design and Construction
Intermediate Code Generation
Semantic Analysis Chapter 6. Two Flavors  Static (done during compile time) –C –Ada  Dynamic (done during run time) –LISP –Smalltalk  Optimization.
1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
Abstract Syntax Mooly Sagiv html:// 1.
Lecture 3: Topics If-then-else Operator precedence While loops Static methods Recursion.
9/27/2006Prof. Hilfinger, Lecture 141 Syntax-Directed Translation Lecture 14 (adapted from slides by R. Bodik)
BROOM: A Matrix Language Chris Tobin Michael Weiss Gabe Glaser Brian Pellegrini.
Introduction to Code Generation Mooly Sagiv html:// Chapter 4.
Introduction to ML - Part 2 Kenny Zhu. What is next? ML has a rich set of structured values Tuples: (17, true, “stuff”) Records: {name = “george”, age.
Chapter 6 Type Checking Section 0 Overview
Tentative Schedule 20/12 Interpreter+ Code Generation 27/12 Code Generation for Control Flow 3/1 Activation Records 10/1 Program Analysis 17/1 Register.
Environments and Evaluation
(S i m p l e) ? P D F M a n i p u l a t i o n L a n g u a g e Stefano Pacifico Jayesh Kataria Dhivya Khrishnan Hye Seon Yi.
1 Problem 2 A Scanner / Parser for Simple C. 2 Outline l Language syntax for SC l Requirements for the scanner l Requirement for the parser l companion.
Compiler Summary Mooly Sagiv html://
Introduction to Code Generation Mooly Sagiv html:// Chapter 4.
MDraw Graphics Manipulation Language Huimin Sun(hs2740) Dongxiang Yan(dy2224) Jingyu Shi (js4151) COMS 4115 Columbia University August 16, 2013.
Symbol Table (  ) Contents Map identifiers to the symbol with relevant information about the identifier All information is derived from syntax tree -
Abstract Syntax Trees Lecture 14 Wed, Mar 3, 2004.
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.
Graphics and Procedures Programming Right from the Start with Visual Basic.NET 1/e 5.
Programming Training kiddo Main Points: - Python Statements - Problems with selections.
Project 1 Due Date: September 25 th Quiz 4 is due September 28 th Quiz 5 is due October2th 1.
1 Turtle Graphics and Math Functions And how you can use them to draw cool pictures!
Logo For beginners By Dali Matthews 9S What is logo?
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Semantic Analysis. Find 6 problems with this code. These issues go beyond syntax.
5-1 5 Compilation  Overview  Compilation phases –syntactic analysis –contextual analysis –code generation  Abstract syntax trees  Case study: Fun language.
CONTROL SYSTEMS Control Systems A command is a directive that performs a specific task An argument is a variable that can be used by the function reveiving.
Parse & Syntax Trees Syntax & Semantic Errors Mini-Lecture.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
Simple One-Pass Compiler
Introduction to Code Generation and Intermediate Representations
Semantic Analysis Semantic Analysis v Lexically and syntactically correct programs may still contain other errors v Lexical and syntax analyses.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
The Functions and Purposes of Translators Syntax (& Semantic) Analysis.
INTRODUCTION TO COMPILERS(cond….) Prepared By: Mayank Varshney(04CS3019)
CSC 143A 1 CSC 143 Introduction to C++ [Appendix A]
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
CS412/413 Introduction to Compilers Radu Rugina Lecture 13 : Static Semantics 18 Feb 02.
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
FUNCTIONS. Midterm questions (1-10) review 1. Every line in a C program should end with a semicolon. 2. In C language lowercase letters are significant.
Language Implementation Overview John Keyser Spring 2016.
CS412/413 Introduction to Compilers Radu Rugina Lecture 11: Symbol Tables 13 Feb 02.
©SoftMoore ConsultingSlide 1 Structure of Compilers.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
What is it? How to use it and how useful can it be?
Semantic Analysis. Find 6 problems with this code. These issues go beyond syntax.
Open Source Compiler Construction (for the JVM)
Lecture 9 Symbol Table and Attributed Grammars
Constructing Precedence Table
Introduction to Parsing (adapted from CS 164 at Berkeley)
Overview of Compilation The Compiler Front End
Overview of Compilation The Compiler Front End
Overview of Compilation The Compiler BACK End
-by Nisarg Vasavada (Compiled*)
Basic Program Analysis: AST
Algorithms and Flow Charts
Lecture 15 (Notes by P. N. Hilfinger and R. Bodik)
CSE401 Introduction to Compiler Construction
C# Basics These slides are designed for Game Design Class
Overview of Compilation The Compiler BACK End
C H A P T E R T W O Syntax.
Parameters and Arguments
Presentation transcript:

PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang

Overview of COLOGO Columbia LOGO Motivation: For educational use 1. an effective programming language for drawing 2D graphics 2. designed in spirit of low threshold, easily implemented.

Function Feature Euclidean Pictures Creating Functions Recursive Iridescent Simple Data Structure such as Array. Support direct HTML and Javascript Output

COLOGO VS. LOGO Colorful Compile together No list

Language Tutorial

Some examples of our program Fibonacci Recursive

Some examples of our program Olympic Rings (faked)

Rainbow Some examples of our program

Language Tutorial Variable Declaration Int a,b; Bool c; foo d; (:foo is a object:) Int e[10]; (:array:)

Language Tutorial Expression Assignment: a = 1; c = True; Arithmetic Expression: a = b + a; Comparison Expression: c = a < b; Logical Expression: c = (a == b); Not c; Function call: a = testfunc(b); Comment: (:This is a comment:)

Language Tutorial Loop Loop(10) { a = a + 1; } Loop(10) { a = a + 1; Break; } Loop(10) { a = a + 1; Goon;}

Language Tutorial Condition If (c) { a = b; } End If (c) { a = b; } Else { b = a; } End

Language Tutorial Jump If (c) { a = b; } End If (c) { a = b; } Else { b = a; } End

Language Tutorial Draw Move Forward: FD 10; Move Backward: BK 10; Turn Left: LF 90; Turn Right: RT 90;

Language Tutorial Draw Reset position: RESET; Clear Screen: CLS; Pen Operation: PU; PD; PF; Line Width: WD 10; Set Line Color: RGB 255, a, e[2]

Language Tutorial Function Declaration: Func testfunc(int n) : int { Return n;} Call: a = testfunc(b);

Language Tutorial Object Definition: Obj foo { int bar; int baz;} Declaration: foo d; Reference: dot operator d.bar = a; b = d.baz;

Implementation

Layout

Flow Ast: Abstract Syntax Tree Types Definition One Rule -> One Type Constructor

Flow Scanner: Generate Tokens Parser: Generate AST Use Type Constructor Defined in AST

Flow Scanner: Generate Tokens Parser: Generate AST Use Type Constructor Defined in AST Basic Error Recovery

Flow Semantic: Traversal of AST, Checking Variables, Function Definitions, Type Matching, etc. Generator: Traversal of AST, Generate JS code in HTML file Printer: Traverse and print the AST

Flow Semantic: Traversal of AST, Checking Variables, Redefinition Type Matching: Array Object Function Matching Parameter Count, Argument Type Return Type Definition Scope Stack faked by List Small Features: infinite loop

Flow Generator: Traversal of AST Generate JS Code in HTML5 file Draw Statement Array in Obj

Flow

SUMMARY Further to develop Lessons learned