EZ-ASCII A Language for ASCII-Art Manipulation

Similar documents
Matt Meisinger, Akshata Ramesh, Alex Dong, Kate Haas

EZ- ASCII: Language Reference Manual

Shalva Kohen Arunavha Chanda Kai-Zhan Lee Emma Etherington

Geo. A geometric solution language. Qi Wang, Yuechen Zhao Zichen Chao, Ziyi Luo

blur Melissa Kaufman-Gomez Team Leader Timothy Goodwin System Architect Dexter Callender Language Guru Daniel Hong Test Wizard

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan

CSCE 314 Programming Languages. Type System

Bash command shell language interpreter

UNIVERSITY OF COLUMBIA ADL++ Architecture Description Language. Alan Khara 5/14/2014

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Homework #3: CMPT-379

Chapter 2: Introduction to C++

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

C Introduction. Comparison w/ Java, Memory Model, and Pointers

LECTURE 3. Compiler Phases

Introduction to Programming Using Java (98-388)

The Warhol Language Reference Manual

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 INSTRUCTIONS

tiler. A 2D turn-based gaming language Tester: Jacky Cheung Manager: Jason Lei System Architects: Jiayin Tang, Evan Ziebart Language Guru: Monica Ting

COP4020 Programming Assignment 2 - Fall 2016

GaE Graphs Ain t Easy. Andrew Jones (adj2129) Kevin Zeng (ksz2109) Samara Nebel (srn2134)

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

C - Basics, Bitwise Operator. Zhaoguo Wang

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

Outline. 1 Compilers. 2 Why Study Compilers? 3 The Phases of Compilation. 4 Overview of the j-- to JVM Compiler. 5 The j-- Compiler Source Tree 2 / 29

Modules, Structs, Hashes, and Operational Semantics

LECTURE 02 INTRODUCTION TO C++

Motivation was to facilitate development of systems software, especially OS development.

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking

blur (.blr) Project Proposal Dexter Callender dec2148 Tim Goodwin tlg2132 Daniel Hong sh3266 Melissa Kaufman-Gomez mhk2149

Section - Computer Science. int main() {! int a=10,b=20;! printf("a:%d B:%d\n",a,b);! a=(a+b)-(b=a);! printf("a:%d B:%d\n",a,b);!

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

CMSC 330: Organization of Programming Languages

Amit Shravan Patel UNI: ap3567 COMS W4115 (CVN) Prof. Stephen Edwards Final Project Report AP++

Motivation was to facilitate development of systems software, especially OS development.

Edward Garcia (ewg2115) Naveen Revanna (nr2443) Niket Kandya (nk2531) Sean Yeh (smy2112)

11. a b c d e. 12. a b c d e. 13. a b c d e. 14. a b c d e. 15. a b c d e

Compilers Project 3: Semantic Analyzer

Programming Languages Third Edition. Chapter 7 Basic Semantics

Writing Evaluators MIF08. Laure Gonnord

CSC 126 FINAL EXAMINATION Spring Total Possible TOTAL 100

CS 415 Midterm Exam Spring SOLUTION

BoredGames Final Report A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

COP4020 Programming Assignment 2 Spring 2011

Melody: A Music Programming Language Final Report

String Computation Program

Short Notes of CS201

Syntax-Directed Translation. Lecture 14

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

Compiling and Interpreting Programming. Overview of Compilers and Interpreters

Array. Prepared By - Rifat Shahriyar

SSOL Language Reference Manual

COMPILER CONSTRUCTION LAB 2 THE SYMBOL TABLE. Tutorial 2 LABS. PHASES OF A COMPILER Source Program. Lab 2 Symbol table

Lecture 2 Tao Wang 1

CS201 - Introduction to Programming Glossary By

CA Compiler Construction

CS 415 Midterm Exam Spring 2002

Names, Scope, and Bindings

Programming. Syntax and Semantics

Pointers, Dynamic Data, and Reference Types

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Compiler Design (40-414)

C++ Programming: From Problem Analysis to Program Design, Third Edition

Computer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Basic Elements of C++

Pace University. Fundamental Concepts of CS121 1

Language Reference Manual

The Structure of a Syntax-Directed Compiler

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

C++ Support Classes (Data and Variables)

CAAM 420 Daily Note. Scriber: Qijia Jiang. Date: Oct.16. Project 3 Due Wed 23.Oct. Two parts: debug code and library exercise.

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

Language Reference Manual simplicity

Creating a C++ Program

Why are there so many programming languages?

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING

Section 2.2 Your First Program in Java: Printing a Line of Text

The Substitution Model

CS 11 Ocaml track: lecture 6

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

MIDTERM EXAMINATION - CS130 - Spring 2005

egrapher Language Reference Manual

Test I Solutions MASSACHUSETTS INSTITUTE OF TECHNOLOGY Spring Department of Electrical Engineering and Computer Science

Semantic Analysis. Compiler Architecture

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

CMSC 330: Organization of Programming Languages

Casper. A high-level general-purpose programming language. Final Report. Languages and Translators. Michael Makris UNI: mm3443. COMS W4115 Programming

The role of semantic analysis in a compiler

CMSC 330: Organization of Programming Languages. Operational Semantics

CS558 Programming Languages

Today. Assignments. Lecture Notes CPSC 326 (Spring 2019) Quiz 5. Exam 1 overview. Type checking basics. HW4 due. HW5 out, due in 2 Tuesdays

27-Sep CSCI 2132 Software Development Lecture 10: Formatted Input and Output. Faculty of Computer Science, Dalhousie University. Lecture 10 p.

Lecture 03 Bits, Bytes and Data Types

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 97 INSTRUCTIONS

Transcription:

EZ-ASCII A Language for ASCII-Art Manipulation Dmitriy Gromov Joe Lee Yilei Wang Xin Ye Feifei Zhong December 18, 2012

Introduction Purpose: creating and manipulating ASCII Art Goals: Easy creation, manipulation, and storage of ASCII images Mapping / Converting intensities to characters Flexible features with simple syntax

Tutorial : How to compile and run 1. Extract the EZ-ASCII compiler source files into a directory. 2. Run make to build the executable ezac. 3. The ezac executable takes a.eza source file as input, and allows some command-line parameters. A usage example is ezac [options] <source-file>.

Tutorial: A First EZ-ASCII Program A simple Hello, world! program could look like the following: d <- Hello, world! ; // store string in variable d d -> out; // output d to stdout

Tutorial: More Examples Looping: for i <- 0 i < 5 i <- i + 1 { i -> out; } Functions: d <- 2; fun foo(p) { p -> testfile.txt ; // output value of p to file d -> out; // d refers to the global d, outputs 2 a <- 4; // a is a new local return a; }

Types Usable Types Int Bool String Canvas Special Types Void No Type Declarations All can be inferred based on how they are created

Scoping Global scope Global variables are accessible everywhere (but assignments only allowed in global scope) Local (function) scope Local variables have lifetime within function body Rules for variable lookup within a function: Match against function parameter list Match against global variables Finally, create a new local variable Rules imply that globals protected in function scopes

Modular Execution include filename ; Can include other files directly Preprocessor replaces include with code from the given file Optional main C style main function Global statements executed first

Execution Storage Stack Used to store references and integers Heap Hashtable for complex types String Canvas Bool To not convert to 0 and 1 Lct (Load Complex Type) Byte code

Architecture Primary Modules ezac.ml Primary module preprocess.ml scanner.mll parser.mly ssanalyzer.ml compiler.ml execute.ml Function Top-level module with command-line options. Recursively replace include statements with respective source files Converts source into stream of tokens Parses stream of tokens into an AST tree (ast.ml) First pass through program, outputs compile-time errors (type errors, undefined var/fxn errors, etc ) Second pass through program, generate bytecode (bytecode.ml) Executes bytecode

Architecture Support Modules Support module canvas.ml hashtypes.ml sast.ml ast.ml interpret.ml bytecode.ml Function Canvas type handling, operations, called during execution by execute.ml. Hashing support for complex (non-integer) types. Define sast (semantically-checked ast) Defines abstract syntax tree. Runs an AST program on the fly (no bytecode generation). Defines byte-codes for compiler. load_image.py calls PIL for image loading Makefile builds runtests.sh shell script for unit testing

Canvas 2D Array of Integers Each int -> Intensity Domain -> [-1, Granularity) Rendering Intensity Map -> {intensity, ascii-char} If granularity < map cardinality ~Evenly distribute intensity in map -1 means null cell (not rendered)

Canvas Functions Load : From jpeg, png or.i (intensity file) Blank : New canvas with all 0s Shift : Shift canvas up, left, down Select : By point range(position), or boolean(intensity) Set : 1 value to some selected range Mask : Layer one canvas on top of another.

Canvas Load PIL (Python Image Library) Load image Convert to grey scale Shrink down to at most 100 x 100 image If not square will keep ratio If smaller than 100 x 100 stays same size Stores intensity file to tmp dir in lang directory File gets loaded into canvas If.i file already loads file directly

Demo

Lessons Learned 1. OCaml has a steep learning curve but is effective for compilers. 2. GIT is of huge help in keeping track of the progress 3. Get AST, Scanner and Parser done early 4. Unit test ensures code work 5. Close Teamwork and frequent communication really important in this project

END Thank You!