Syntax and General

  1. Comment

    Two slashes // start a comment line. A matched pair of /* and */ enclose multiple lines of comments.

    The percent sign % is used as the mod operator.

  2. Space is not a separator

    Shang is more strict on free-form syntax and doesn't allow using space or newline as separators. When a matrix is created using bracket expression, elements must be separated by comma or semicolon. For example, A = [3, 5, -1; 2, -7, 9]. In particular, A = [3 5 -1; 2 -7 9] would result in syntax error, while A = [5 -1; 2 -7] gives A = [4, -5].

  3. No distinction between "function file" and "script file"

    There is no "function file"; every program file is a "script" file. A script file can contain any number of function definitions.

  4. No automatical loading of program files

    Interpreter does not load script files automatically. To run the commands in a file prog.x, one has to do run("prog.x") or with("prog.x").



oz 2009-12-22