- Main Page
- Namespaces
- Files

- File List
- File Members

# C:/Musimathics_local/Musimat/MusimatTutorial/MusimatTutorial.cpp

Go to the documentation of this file.

    00001 /* $Revision: 1.1 $ $Date: 2006/09/08 19:11:36 $ $Author: dgl $ $Name:  $ $Id: _musimat_tutorial_8cpp-source.html,v 1.1 2006/09/08 19:11:36 dgl Exp $ */
    00002
    00003 /*****************************************************************************
    00004 About the Musimat Tutorial
    00005
    00006 In "Musimathics Vol. 1", Gareth Loy introduces a language he calls "Musimat"
    00007 taylored for the musical examples in his book.  He describes Musimat as
    00008 "C++ in sheep's clothing."  Indeed, Musimat is a simplified
    00009 version of C++ designed for didactic purposes.  Nonetheless, it provides
    00010 a straightforward introduction to programming in a modern computer language
    00011 and provides insightful demonstrations of how to begin to adapt such
    00012 a language to musical purposes.
    00013
    00014 The following tutorial introduction to the Musimat programming language
    00015 is based on Appendix B of "Musimathics Vol. 1", Published by the MIT Press
    00016 and © 2006 Gareth Loy.
    00017
    00018 It can be read as text, and you can step through the code with your debugger
    00019 to see it in action.  To do so, plant a breakpoint on the first function call
    00020 inside the main() routine at the bottom of this file, and step into the first
    00021 function there, named B0100().
    00022
    00023 In order to follow the flow of
    00024 Appendix B of "Musimathics", the tutorial had to be broken into a set of
    00025 unique functions.  You can follow the narrative through the tutorial by
    00026 using your debugger to step into the next tutorial function when the
    00027 previous one returns to main().  See the main() function at the bottom
    00028 of this file for more details.
    00029
    00030 The section names in this tutorial are the
    00031 same as Appendix B in "Musimathics".  For example, tutorial function B0108()
    00032 corresponds to the text in section B.1.8 of that appendix.
    00033 *****************************************************************************/
    00034
    00035 // The Musimat Tutorial © 2006 Gareth Loy
    00036 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy
    00037 // and published exclusively by The MIT Press.
    00038 // This program is released WITHOUT ANY WARRANTY; without even the implied
    00039 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00040 // For information on usage and redistribution, and for a DISCLAIMER OF ALL
    00041 // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
    00042 // "Musimathics" is available here:     http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
    00043 // Gareth Loy's Musimathics website:    http://www.musimathics.com/
    00044 // The Musimat website:                 http://www.musimat.com/
    00045 // This program is released under the terms of the GNU General Public License
    00046 // available here:                      http://www.gnu.org/licenses/gpl.txt
    00047
    00048 #ifndef __GNUC__
    00049 #include "stdafx.h"
    00050 #endif
    00051 #include <iostream>
    00052 using namespace std;
    00053 #include "MusimatTutorial.h"
    00054
    00055 #ifndef __GNUC__
    00056 int _tmain(int argc, _TCHAR* argv[])
    00057 #else
    00058 int main(int argc, char* argv[])
    00059 #endif
    00060 {
    00061         // Plant your first breakpoint on the line below containing
    00062         // B0100().  Then run the program, which will stop just
    00063         // before executing that function.  To start the tutorial, use the
    00064         // debugger's "step into" command to step into the function.
    00065         MusimatTutorial::B0100();       // Introduction to Musimat — The programming language for "Musimathics"
    00066
    00067         // When you get here, you've finished stepping through B0100().
    00068         // To continue the tutorial, use the debugger's "step into" command to
    00069         // step into the next function.
    00070         MusimatTutorial::B0101();       // B.1.1 Basic Elements
    00071
    00072         // Use the debugger's "step into" command to continue the tutorial
    00073         // by stepping into each of the following functions.
    00074         // For some sections, there may be additional functions for you
    00075         // to visit within each file.
    00076         MusimatTutorial::B0102();       // B.1.2 Statements and Expressions
    00077         MusimatTutorial::B0103();       // B.1.3 Data Types
    00078         MusimatTutorial::B0104();       // B.1.4 Constants
    00079         MusimatTutorial::B0105();       // B.1.5 Variables
    00080         MusimatTutorial::B0106();       // B.1.6 Reserved Words
    00081         MusimatTutorial::B0107();       // B.1.7 Lists
    00082         MusimatTutorial::B0108();       // B.1.8 Operators and Operands
    00083         MusimatTutorial::B0109();       // B.1.9 Assignment
    00084         MusimatTutorial::B0110();       // B.1.10 Relations
    00085         MusimatTutorial::B0111();       // B.1.11 Logical Operations
    00086         MusimatTutorial::B0112();       // B.1.12 Operator Precedence and Associativity
    00087         MusimatTutorial::B0113();       // B.1.13 Type Promotion and Type Coercion
    00088         MusimatTutorial::B0114();       // B.1.14 Accessing List Elements
    00089         MusimatTutorial::B0115();       // B.1.15 Functions
    00090         MusimatTutorial::B0116();       // B.1.16 Conditional Statements
    00091         MusimatTutorial::B0117();       // B.1.17 Compound Statements
    00092         MusimatTutorial::B0118();       // B.1.18 Iteration
    00093         MusimatTutorial::B0119();       // B.1.19 User-Defined Functions
    00094         MusimatTutorial::B0120();       // B.1.20 Invoking Functions
    00095         MusimatTutorial::B0121();       // B.1.21 Scope of Variables
    00096         MusimatTutorial::B0122();       // B.1.22 Pass by Value vs. Pass by Reference
    00097         MusimatTutorial::B0123();       // B.1.23 Type Conversion
    00098         MusimatTutorial::B0124();       // B.1.24 Recursion
    00099         MusimatTutorial::B0125();       // B.1.25 Recursive Factorial
    00100         MusimatTutorial::B0126();       // B.1.26 Fibonacci Numbers
    00101         MusimatTutorial::B0127();       // B.1.27 Other Built-in Functions
    00102         MusimatTutorial::B0128();       // B.1.28 Comments
    00103         MusimatTutorial::B0129();       // B.1.29 Representing Text
    00104         MusimatTutorial::B0200();       // B.2 Music Datatypes in Musimat
    00105         MusimatTutorial::B0201();       // B.2.1 Pitch
    00106         MusimatTutorial::B0201a();      // Equal-Tempered Frequency
    00107         MusimatTutorial::B0201b();      // Pythagorean Chromatic Scale
    00108         MusimatTutorial::B0201c();      // Natural Chromatic Scale
    00109         MusimatTutorial::B0201d();      // Sruti Scale
    00110         MusimatTutorial::B0202();       // B.2.2 Rhythm
    00111         MusimatTutorial::B0203();       // B.2.3 Tempo
    00112         MusimatTutorial::B0204();       // B.2.4 Loudness
    00113         MusimatTutorial::B0300();       // B.3 Unicode (ASCII) Character Codes
    00114         MusimatTutorial::B0400();       // B.4 Operator Associativity and Precedence in Musimat
    00115
    00116         Return 0;
    00117 }
    00118
    00119