Unformatted text preview:

Arithmetic Calculation Language Nathan Corvino February 8 2011 The Artihmetic Calculation Language ACL focuses on arithmetic operations combined with common procedural control structures It s primary motivation is to explore assembly code generation as such it is primarily focused on remaining simple to keep this task tractable At the same time it does strives to explore as many different code constructs as feasible It includes variables conditionals loops and function calls The syntax is c like Statements are terminated with a semicolon and a list of statements can be enclosed in brackets Data Types ACL will support floats and ints although it will not necessarily support automatic type coerecion Operators Addition subtraction multiplication and division will be supported on either ints or floats Cast operations will be supported for converting between floats and ints Comparison operators allowed will be and 1 Control Structures ACL will support while loops and if else structures Functions Function calls will be supported and at least four parameters will be supported Return types of int float and void that is no return type will be supported The program entry point will be the main method which returns an int Passing command line arguments to it will not be supported Example An 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 2 This sample program returns 64 when compiled by gcc as expected it should do the same when compiled by the ACL compiler This example demonstrates ints and floats being used in conjuction with casts comparisons looping branching and function calls 3


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
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 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?