NAME
DESCRIPTION
Minc (M _is _not _c) is the data specification language for Cmix. It was written by Lars Graf. Minc *almost* follows a c-like syntax. Arithmetic, conditional and logical expressions are permitted, as well as looping. Any statment of the form foo(val,num, etc) results in the execution of foo() if it is a Cmix procedure and declared as such, either in the user's profile.c or in Cmix's ug_intro.c. If it is neither the evaluated terms within parentheses will simply be printed and returned. The arguments within the parentheses are passed to the Cmix procedure in its float *p array. All variables must be declared as float. The sign ; has the meaning 'clear out any syntax errors'. Cmix routines such as open, input, output which have a file name as a first argument, must pass that argument between " signs.

Minc, has two modes of operation: batch and interactive (the default). The only difference between them is that loops cannot be executed in interactive mode. To run in batch mode a -b flag must be specified on the Cmix command line, and all data must be entered either by redirecting input from a file, or by typing all data followed by a <cntrl-D>. Comments are inclosed by /* and */ as in C. Any user function which returns a value can return that value to Minc if it is declared as a type double and introduced in the profile.c file.

The following is Lars Graf's formal statement of the language:

     Order of precedents:

     ||
     &&
     =  !=
     < >  <= >=
     + -
     * /
     **  ^


     CASTS

     Syntax:

     prg: stml

     stml :        stmt
          |   stml  stmt
          |   stmt ;
          |   stml  stmt ;

     stmt:         float idl           /* declare ids */
          |   id  = exp
          |   IF bexp stmt
          |   IF bexp stmt ELSE stmt
          |   WHILE bexp stmt
          |   FOR ( stmt , bexp , stmt ) stmt
          |   id ( expl )     /* a call to a cmix function  */
          |   { stml }


     idl:     id              /* like: fnct_name(arg1,arg2,arg3) */
          |   idl , id

     id:   any letter/digit/"_" combination, but start with letter

     expl:       exp
          |   exp ',' expl
          |   or no function argument

     bexp:         exp
          |   ! bexp
          |   bexp &&  bexp
          |   bexp ||  bexp
          |   bexp = bexp   /* note the comparison of booleans */
          |   exp < exp
          |   exp > exp
          |   exp != exp
          |   exp <= exp
          |   exp >= exp
          |   TRUE
          |   FALSE

     exp:     exp ** exp
          |   - exp
          |   exp * exp
          |   exp / exp
          |   exp + exp
          |   exp - exp
          |   ( bexp )
          |   any number: e.g. 34 -645.34 234.E23  ...


     Note:

     1)  Semicolon and  are optional.

     2)  '=' is used for assignments and boolean expressions.

     3)  False = 0; True = 1(or nonzero).




     Samples:

     /*  this is a legal comment  */

     float foo,x;

     if i=3 && foo>4  say_mumble( foo**i , i-foo*3)
          else mumble_foo()


     while x=3 {

          this_is_a_cmix_function_call()
          x= 5 * (foo=i)     /* this is slime */

     while true nested_loops_are_possible()
     }


     for (x=1, x <= 10,x=x+1) dispatch(x)


     Minc also has the following facilities:

     1)  function calls can return values

          e.g.      i = rand(j)

          NOTE:  those are calls to your own C-functions.
                 You may adjust your dispatcher and your functions accordingly
                 The function must be introduced in the profile, and must
                 be of type double.

     2)  assignment statements have the value of the assignment.

          e.g.      i = j = 5
                 while (i=j) == 5  { mumblings .. }

     3)  strings can be passed as arguments.

          e.g.      file_id = open("name of file",2)
                    printf("some string %f %f0,i,j)
               /* of course, the dispatcher has to know about printf */

          NOTE:   the string pointer is passed as a double; to convert
               back, you have to first cast it into an integer, and then
               you have to cast the integer into a char*.

     4)  use '=' for assigment; and '==' as the booleam equal operator.


     Here is a simple example file:

     open("sf/bigsound",0,0)
     open("sf/bigmix",1,2)
     sfclean(1)
     float a,b,c,d
     a=2 b=3 c=28000 d=-4
     sound(a,b,c,1,22*19,d=d-a)
     sound(a=a+2, b+.1, 99, d=d-a+2)

DIAGNOSTICS
Syntax errors are noted and very often will cause big trou- ble. It is recommended that any files be tested with parse, which is a standalone version of Minc. Just say parse < file.