Unformatted text preview:

Mirage A Graphical Sketching Language Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Prof Stephen Edwards Team Members Abhilash I Ming Liao Nalini Vasudevan Peili Zhang ai2160 columbia edu ml2288 columbia edu nv2144 columbia edu pz2128 columbia edu Table of Contents Chapter 1 Introduction 5 1 1 Overview 5 Motivation 5 Description 5 1 2 Language features 6 Primitive Data Types 6 Key words 6 Comparative and Mathematical Operators 6 Control Statements 6 Other Features 6 Syntax 7 1 3 Design Goals 8 Simplicity and Intuitive 8 Efficiency and Flexibility 9 Robust and High performance 9 Portability 9 1 4 Sample Programs 9 Chapter 2 Tutorial 12 2 1 Program Flow 12 2 2 Sample Program 12 Chapter 3 Language Reference Manual 15 3 1 Lexical Conventions 15 Tokens 15 Comments 15 Identifiers 15 Keywords 15 Constants 15 Integers 16 Strings 16 Other Kinds of Tokens 16 3 2 Types 16 3 3 Expressions 16 Primary Expressions 16 Identifiers 17 Constant 17 Integers Strings 17 expression 17 Primary expression expression list 17 Primary expression expression list 17 Arithmetic Expressions 17 Unary Operators 17 2 Binary Operators 18 Multiplicative Operators 18 Relational Operators 18 Equality Operators 18 Logical Operators 19 Assignment Operator 19 Other Operators 19 Operator Precedence and Associativity 19 3 4 Declarations 20 Variable Declarations 20 Type Specifiers 20 Declarators 20 Function Definitions 20 3 5 Statements 21 Expression statement 21 Compound statement 22 Conditional statements 22 Iterative Statements 22 Break statement 23 Return Statements 23 Graphics Drawing Statements 23 Colors 23 Graphics Motion 24 Pen State 24 Graphic Shape 25 3 6 Scope Rules 26 3 7 Miscellaneous 26 3 8 Sample Mirage Program 27 3 9 References 28 Chapter 4 Project Plan 29 4 1 Timeline 29 4 2 Team Responsibilities 30 4 3 Project Log 30 4 4 Programming Guide and Software Development Environment 32 Software Development Environment Table 32 Java 32 Operating Systems 32 ANTLR ANother Tool for Language Recognition 32 IDE 33 CVS 33 Chapter 5 Architectural Design 34 Lexer 36 Parser 36 AST Walker 36 3 Control Flow 36 Function Handling 37 Scoping and Symbol Table 37 Declaring a function 38 Calling a function 39 Declaring a variable 39 Accessing a variable 39 Error Handling 39 Chapter 6 Testing Plan 40 6 1 Unit testing 40 6 2 Basic graphic operations testing 41 6 3 Integrated testing 43 Chapter 7 Lessons Learned 47 7 1 Abhilash I 47 7 2 Ming Liao 47 7 3 Nalini Vasudevan 48 7 4 Peili Zhang 48 Appendix A Source Code 50 A 1 Front End 50 A 2 Back End 59 A 3 Testing Cases 73 4 Chapter 1 Introduction 1 1 Overview Motivation The main objective of our project is to develop a simple elegant and powerful graphical language that not only does assist the learning process for the beginners but also help the skilled programmers to create preliminary and intermediate level graphics with an interpreter which makes programming much efficient in certain graphical applications fields Mirage was motivated by the Logo Programming Language and the idea was to merge Logo and C to provide a C like syntax with Logo drawing features Description The Mirage programming language is designed to be a graphic specific functional and translated programming language with the target language being Java The graphic output of the Mirage is produced from the Java swing package since it provides sufficient utilities to generate any 2D graphics Similar to Logo programming language Mirage is easy to read write and learn It is used mainly for educational purpose especially for teaching and inspiring programming beginners It can also enable more advanced programmers to create fantastic turtle curves using recursive function calls Moreover Mirage graphics is useful for example in Lindenmayer system for generating fractals for example the dragon curve or hilbert curve Not only can it create Mirage graphics but also it provides useful facilities for handling image I O Moreover Mirage can be used to teach most basic computer science concepts Mirage also supports graphcial animations For example the motion of move forward 50 pixels or turn certain angle clockwise depend on the defined speed In general from the small building blocks programmers are able to build more complex geometries and any graphics 1 2 Language Features The Pen is a pre defined object which is used to draw geometries and graphics 5 Primitive Data Types There is only one basic numerical data type in Mirage namely the integer It is used for specifying the moving distances turning angles of the Pen and the curve s offset percentage as well as for doing more advanced calculations to enable programmers to create complex geometries or graphics The void data type is used for specifying the type of the function when it is not returning anything Key words All the key words are written in the lower case For example up down return break and while etc Comparative and Mathematical Operators Operators are necessary for condition checking and calculations Mirage have all the essential comparative and mathematical operators for examples and so on Control Statements To control program s flow and carry out certain algorithms we will implement and support the following control statements while loop for example we can use a while loop to draw certain geometries repeatedly for loop for example we can use a for loop to repeat a line certain times if else condition for example depends on different conditions we can use if else to draw different geometries Other Features Each procedure or function encloses a group of statements by and Each statement is separated by a Comments start with and ends with Motion of PEN include fwd bwd rgt lft etc Pen State include up down reset Pen color can be any color for example one can use color code R G B to specify certain color Turn eraser on and off can be set using the eraseon and eraseoff keywords 6 Syntax The syntax of Mirage resembles Logo but with some modifications For example some basic syntax will be as follows int variable name all variable are Integer type It is a local variable if defined in a procedure or a global variable if passed to any procedure up or down indicate the state of PEN color 255 0 0 color code specifies the PEN color thick t specify the thickness of PEN where t range in 1 10 speed sp specify the speed of PEN where sp range in 0 1000 fwd 40 or bwd 30 specify the moving direction and distance of PEN rgt 20 or lft 5 specify turning


View Full Document

Columbia COMS W4115 - Mirage A Graphical Sketching Language

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Loading Unlocking...
Login

Join to view Mirage A Graphical Sketching Language and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Mirage A Graphical Sketching Language and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?