m A language for music generation. Language Reference Manual Yiling Hu (yh2378) Monica Ramirez‐Santana (mir2115) Jiaying Xu (jx2129) Table of Contents Language Reference Manu al ........................................................................................................................ 3 Introduction .............................................................................................................................................. 3 Lexical Conventions ................................................................................................................................... 3 Tokens ................................................................................................................................................... 3 Comments ............................................................................................................................................. 3 Identifiers .............................................................................................................................................. 3 Keywords ............................................................................................................................................... 3 Literals ................................................................................................................................................... 4 Identifiers .................................................................................................................................................. 4 Scope ..................................................................................................................................................... 5 Types ..................................................................................................................................................... 5 Objects ...................................................................................................................................................... 6 Objects, lvalues, and rvalues ................................................................................................................. 6 Promotion ............................................................................................................................................. 6 Expressions................................................................................................................................................ 6 Primary Expressions .............................................................................................................................. 6 Postfix Expressions ................................................................................................................................ 7 Unary Operators ................................................................................................................................... 7 Multiplicative Operators ....................................................................................................................... 8 Additive Operators ................................................................................................................................ 8 Relational Operators ............................................................................................................................. 8 Equality Operators ................................................................................................................................ 9 Logical AND Operator ........................................................................................................................... 9 Logical OR Operator .............................................................................................................................. 9 Assignment Expressions ........................................................................................................................ 9 Declarations ............................................................................................................................................ 10 Function Declarators ........................................................................................................................... 10 Array Declarators ................................................................................................................................ 10 Initialization............................................................................................................................................. 11 Statements .............................................................................................................................................. 11 Compound Statement ......................................................................................................................... 12 Selection Statements .......................................................................................................................... 12 Iteration Statements ........................................................................................................................... 12 Function Definitions ................................................................................................................................ 12 Grammar ..................................................................................................................................................... 13 Appendix ..................................................................................................................................................... 16 scanner.mll .............................................................................................................................................. 16 parser.mly ............................................................................................................................................... 18 Language Reference Manual Introduction This manual describes the syntax for the m language, a language for algorithmic music generation. Lexical Conventions An m program consists of a single file with the syntax described in this document. Tokens There are five types of tokens: identifiers, keywords, operators, literals, and separators. Spaces, tabs, and newlines (collectively, “white space”) are ignored except when used as separators. Separators are white space that is needed to separate
View Full Document