DOC PREVIEW
Columbia COMS W4115 - Arithmetic Calculation Language

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Arithmetic Calculation LanguageNathan CorvinoFebruary 8, 2011The Artihmetic Calculation Language (ACL) focuses on arithmetic opera-tions, combined with common procedural control structures. It’s primarymotivation is to explore assembly code generation; as such it is primarilyfocused on remaining simple to keep this task tractable. At the same time,it does strives to explore as many different code constructs as feasible. Itincludes variables, conditionals, loops, and function calls.The syntax is c-like. Statements are terminated with a semicolon, and a listof statements can be enclosed in brackets.Data TypesACL will support floats and ints, although it will not necessarily supportautomatic type coerecion.OperatorsAddition, subtraction, multiplication, and division will be supported, on ei-ther ints or floats. Cast operations will be supported for converting betweenfloats and ints.Comparison operators allowed will be <, >, =, <=, >=, and !=.1Control StructuresACL will support while loops and if-else structures.FunctionsFunction calls will be supported, and at least four parameters will be sup-ported. Return types of int, float, and void—that is, no return type—will besupported.The program entry point will be the main method which returns an int.Passing command line arguments to it will not be supported.ExampleAn example program, that illustrates these constructs in action:int abs(int number){if (number < 0) {return -1 * number;} else {return number;}}int power(int base, int exponent){int total = 1;while (exponent > 0) {total = base * total;exponent = exponent - 1;}return total;}int main(){float x = 4.;int y = -3;return power((int) x, abs(y));}2This sample program returns 64 when compiled by gcc, as expected; it shoulddo the same when compiled by the ACL compiler.This example demonstrates ints and floats being used in conjuction withcasts, comparisons, looping, branching, and function


View Full Document

Columbia COMS W4115 - Arithmetic Calculation 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
Download Arithmetic Calculation Language
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Arithmetic Calculation 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 Arithmetic Calculation Language 2 2 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?