Unformatted text preview:

MARS Language Reference Manual Michael Sorvillo Aaron Fernandes Ritika Virmani Swapneel Sheth 1 Table of Contents Language Overview 3 Lexical Conventions 4 1 Keywords 4 2 Arithmetic and Comparison Operators 4 3 Numbers 4 4 Block Declarations 5 i Standard Blocks 5 ii Custom Blocks 5 5 Scoping Rules 5 6 Strings 6 7 Comments 6 8 New Line De limiters 6 9 Identifiers 6 Data Types Attributes 7 1 Fundamentals 7 2 Identifiers 8 3 Primitives 9 4 Actions Attributes 9 5 Attributes 10 Control Flow 11 1 Conditional 11 2 Iterative 11 Compilation Execution 13 Code Samples 14 1 Basic Composition 14 2 Adding a bridge 16 3 Adding complementing harmonies 16 2 Language Overview MARS is an Object Oriented Programming Language with Scripting features It will allow a user the ability to mix and match different tracks audio files on top of one another and add effects to these tracks It will give users a simple way to define their DJ composition logically and give them the ability to listen to and iterate on certain sections of their composition Using MARS a user can define a song as a logical structure as follows 1 Composition 2 Sections 3 Groups 4 Tracks A Track will be an individual audio file mp3 wav etc A Group will be a logical collection of tracks and their behavior effects like fade in etc The default behavior of a group is to overlay all tracks i e to play all tracks simultaneously A Section is a physical grouping and is analogous to sections of a song like intro chorus etc A Section may or may not contain Groups but it must contain Tracks A Composition is a collection of Sections which make up a Song The default behavior for a Composition is to play the Sections in the order in which they are defined in the Source File This behavior can be overridden if needed 3 Lexical Conventions 1 Keywords MARS defines the following set of keywords These keywords are reserved and cannot be used as identifiers composition def double else end for group if int section then to track Table 1 Keywords 2 Arithmetic and Comparison Operators MARS supports all Arithmetic and Comparison Operators similar to C and Java All operators are left associative and have the precedence levels shown below is the Exponentiation operator Hence to calculate 2 3 we would write 2 3 Table 2 Operators 3 Numbers MARS supports 2 types of numbers 1 Integer 1 or more digits 2 Double 1 or more digits followed by a decimal place followed by one or more digits 4 4 Block Declarations MARS supports 2 kinds of blocks i Standard Blocks There are 2 kinds of Standard blocks They are Groups and Sections They can be defined as follows def composition C1 120 def section S1 def group G1 end end end ii Custom Blocks These blocks allow a user to create custom behavior This is similar to a function definition in C or C def custom behavior track t1 track foo foo mp3 t1 kill foo length t1 loop 5 end 5 Scoping Rules MARS is a statically typed language Variable defined in a particular block has the scope of that block Blocks are defined by using the def end construct as shown below def custom behavior track t1 track foo foo mp3 t1 kill foo length t1 loop 5 end foo loop 5 Illegal Access for foo 5 6 Strings MARS supports Strings only when defining a track The Strings are of the form path to file name file type 7 Comments MARS supports single line comments like C C Java etc Comments are indicated by a double forward slash at the start of a comment This is a valid MARS comment 8 New Line De limiters Each line of code in MARS is delimited by a newline character n An explicit semi colon is not required 9 Identifiers Identifiers in MARS start with a letter and can be followed by any number of letters or digits 6 Data Types Attributes 1 Fundamentals The fundamental type of the MARS language is a composition The composition is a set of tracks optionally groups and sections 1 composition a The composition is the foundation of the mars language It acts as a container for the definition of all tracks groups sections delays and custom effects b Compositions must be defined with an integer representing the tempo of the entire composition This must be determined by the user based on the sound files used and if it is not included a syntax error will be thrown Example def composition MikesOpus 120 track bass bass wav end 2 group a Groups are user defined grouping of tracks The main purpose for the definition of groups are so users can group certain tracks in different catagories such as rhythm and melody for ease of use later in the composition b Groups will remain local to the scope in which they are defined similar to C and Java If they are not defined in a section and just defined in the composition they are considered global to the whole composition Example def group rhythm track bass crazyBass wav track snare snareDrum wav end 3 section a Sections are user defined subdivisions of a composition Their main purpose is to allow the user to define a mini composition within their entire composition Because most compositions follow a form where certain musical sections are repeated i e A B A these keywords will allow the user to emulate a real composition b The behavior for a section is to play its tracks and groups with the defined delays and effects Sections will not have the ability to be superimposed over each other as they are meant to be sequential entities 7 c Sections will be played in the order they are defined unless the user specifies otherwise and tells the composition to play them in some other order such as A B A d All tracks and groups must be defined within a section and will remain local for that particular section Example def section A track melody happyMelody wav def group rhythm track bass crazyBass wav track snare snareDrum wav end play melody delay rhythm for 3 measures melody play rhythm delay 3 0 end 4 playOrder a PlayOrder is the main command for the entire composition that allows the user to specify the order in which the defined sections should be played This command will take zero or more arguments sections that will represent the sequential order of the compositions If the user does not specify any arguments the sections will be played once in the order they are defined Examples play section A B then A playOrder A B A play order they are defined playOrder play section A B A A playOrder A B A A 2 Identifiers 1 All the fundamentals are made up of identifiers in the composition These identifiers are defined by the user and must be a letter followed by


View Full Document

Columbia COMS W4115 - MARS Language Reference Manual

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 MARS Language Reference Manual 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 MARS Language Reference Manual 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?