the cily programming language exactly what the world needed

14
The CILY The CILY Programming Language Programming Language Exactly What the World Exactly What the World Needed Needed

Post on 21-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

The CILY The CILY Programming Programming

Language Language

Exactly What the World Needed Exactly What the World Needed

Why Use CILY?Why Use CILY?

One can perform basic to One can perform basic to advanced image manipulation advanced image manipulation operations using an iterative operations using an iterative language (no GUI needed)language (no GUI needed)

Very safe, robust and easy to useVery safe, robust and easy to use It’s works cross-platformIt’s works cross-platform Unlike Photoshop and Unlike Photoshop and

Dreamweaver, CILY is FREE!Dreamweaver, CILY is FREE!

Basic CILY FeaturesBasic CILY Features

Loading and saving images (or entire Loading and saving images (or entire directory of images) for manipulationdirectory of images) for manipulation

Selecting rectangle or oval of pixelsSelecting rectangle or oval of pixels Resizing, rotating, flipping, blurring, Resizing, rotating, flipping, blurring,

sharpening, brightening, cropping, sharpening, brightening, cropping, inverting, edge detecting, and inverting, edge detecting, and converting to grayscaleconverting to grayscale

More Advanced More Advanced FeaturesFeatures

Getting and setting pixel values Getting and setting pixel values of an imageof an image

Magic wand selection of pixels Magic wand selection of pixels Creating a web album from a Creating a web album from a

directory of imagesdirectory of images

CILY Example: Batch CILY Example: Batch Image SharpeningImage Sharpening

CILY source code is as follows:CILY source code is as follows:

main()main(){{

array Image[] imgs = OpenDir(“c:\”);array Image[] imgs = OpenDir(“c:\”);foreach i in imgs foreach i in imgs {{

Sharpen(i);Sharpen(i);Save(i);Save(i);

}}}}

Example CILY SyntaxExample CILY Syntax

function void ConvertToColor(Pixel p, Color c) {function void ConvertToColor(Pixel p, Color c) {p->color = c;p->color = c;return;return;

}}

main() {main() {var Image i = Open("images_original/earth.jpg");var Image i = Open("images_original/earth.jpg");var Color black = Color(0,0,0);var Color black = Color(0,0,0);var Color darkRed = Color(130, 25, 25);var Color darkRed = Color(130, 25, 25);ConvertToGrayScale(i);ConvertToGrayScale(i);array Pixel[] pixels = MagicWand(i, Color(0, 0, 0), 10);array Pixel[] pixels = MagicWand(i, Color(0, 0, 0), 10);foreach j in pixels {foreach j in pixels {

ConvertToColor(pixels[j], darkRed);ConvertToColor(pixels[j], darkRed);}}Paste(i, pixels);Paste(i, pixels);SaveAs(i, "earthgray.jpg");SaveAs(i, "earthgray.jpg");

}}

Output of Previous Output of Previous ExampleExample

Control StructuresControl Structures

ExpressionsExpressionsvar int a = foo() + 3 * (a + b);var int a = foo() + 3 * (a + b);

LoopsLoopsforeach i in imgs { foreach i in imgs {

print(imgs[i]->filename);print(imgs[i]->filename);}}

FunctionsFunctionsfunction void foo() { return; }function void foo() { return; }

Library objects and functionsLibrary objects and functionsBrighten(image);Brighten(image);Color c = Color(255,255,0);Color c = Color(255,255,0);

Compiling CILY Compiling CILY ProgramsPrograms

CILY Program Lexer/Parser

Tree Parse

rError

Checker

Code Gen

Syntax Errors

Semantic Errors

Java program

Generated CodeGenerated Code

Compiler takes CILY program and Compiler takes CILY program and generates an analogous Java generates an analogous Java program.program.

Java program compiled and run Java program compiled and run using J2E 1.4.01using J2E 1.4.01

Java runtime used to run the Java runtime used to run the program.program.

Some examples of Some examples of what CILY can dowhat CILY can do

Photo Album CreatorPhoto Album Creator

Create photo Create photo albums with albums with a call to one a call to one CILY library CILY library functionfunction

Different Different album styles album styles availableavailable

TestingTesting

Automated test suite to run regression Automated test suite to run regression tests after every major grammar change. tests after every major grammar change. Syntax error checking automatically Syntax error checking automatically checkedchecked

Semantic error checking was done Semantic error checking was done partially automatically, partially manually.partially automatically, partially manually.

Took a few days to implement, but saved Took a few days to implement, but saved us a lot of valuable time down the stretchus a lot of valuable time down the stretch

Lessons LearnedLessons Learned

Peer Programming VERY valuablePeer Programming VERY valuable Learned how to “move on” when Learned how to “move on” when

little errors kept us from shipping.little errors kept us from shipping. Diff people testing vs. codingDiff people testing vs. coding Learn to trust your groupLearn to trust your group Learn to like your groupLearn to like your group