Language OverviewLexical Conventions1.Keywords2.Arithmetic and Comparison Operators3.Numbers 4.Block Declarationsi.Standard Blocksii.Custom Blocks5.Scoping Rules6.Strings7.Comments8.New Line De-limiters9.IdentifiersData Types/Attributes1.Fundamentals2.Identifiers3.Primitives4.Actions / Attributes5.AttributesControl Flow1.Conditional2.IterativeCompilation – ExecutionCode Samples1.Basic Composition2.Adding a bridge3.Adding complementing harmoniesMARSLanguage Reference ManualMichael SorvilloAaron FernandesRitika VirmaniSwapneel Sheth1Table of ContentsLanguage Overview......................................................................................................................................3Lexical Conventions.....................................................................................................................................41.Keywords..............................................................................................................................................42.Arithmetic and Comparison Operators..................................................................................................43.Numbers ...............................................................................................................................................44.Block Declarations................................................................................................................................5i.Standard Blocks.................................................................................................................................5ii.Custom Blocks.................................................................................................................................55.Scoping Rules........................................................................................................................................56.Strings...................................................................................................................................................67.Comments.............................................................................................................................................68.New Line De-limiters............................................................................................................................69.Identifiers..............................................................................................................................................6Data Types/Attributes...................................................................................................................................71.Fundamentals........................................................................................................................................72.Identifiers..............................................................................................................................................83.Primitives..............................................................................................................................................94.Actions / Attributes...............................................................................................................................95.Attributes.............................................................................................................................................10Control Flow...............................................................................................................................................111.Conditional..........................................................................................................................................112.Iterative...............................................................................................................................................11Compilation – Execution............................................................................................................................13Code Samples..............................................................................................................................................141.Basic Composition..............................................................................................................................142.Adding a bridge...................................................................................................................................163.Adding complementing harmonies.....................................................................................................162Language OverviewMARS 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. Composition2. Sections3. Groups4. TracksA 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.3Lexical Conventions1. KeywordsMARS defines the following set of keywords. These keywords are reserved and cannot be used as identifiers.composition ifdef intdouble sectionelse thenend tofor trackgroupTable 1: Keywords2. Arithmetic and Comparison OperatorsMARS 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, 23, we would write 2**3.( )**!*, /, %+, ->, >=, <, <=, ==, !=&&, ||Table 2: Operators3. Numbers MARS supports 2 types of numbers. 1. Integer (1 or more digits)2. Double (1 or more digits followed by a decimal
View Full Document