- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5
Language Types and Identifiers
number – Floating point value. The precision is determined by the backend, and in some case may be specified by the user. All computation is done in this format. In particular, integer and Boolean values are treated as floats. Logical operators recognize 0 as false and nonzero as true. Logical operators return exactly 1 for true. A number is written as {digits}{dot}{digits}{exponent}{unit} or 0x{hexadecimal}{unit}. The optional unit follows the UCUM standard. In cases where the unit would produce an ambiguous parse, it may be surrounded by parentheses. Infinity can be written as ∞ or ".inf". Not-a-number can be written as ".nan".
matrix – A 1D or 2D raster of numbers. Used primarily for specifying and manipulating coordinates. A matrix constant has the following format: [1,2,3; 4,5,6; ...]. Rows are separated by semicolons. Values within a single row are separated by commas. The column count in the matrix is determined by the longest row. Any unspecified values in a row are treated as zero. Access an element of a matrix variable with the form M(row,column), where "M" is the name. Access elements in the first column with the form M(row).
All binary operators on matrices are elementwise except as noted. Elementwise operators return a matrix with the same shape as the left operand. Missing elements in the right operand are given an identity value appropriate to the operator. Extra elements in the right operand are ignored.
reference – Points to a part instance as it exists at runtime. Any part that defines one or more references is called a "connection". Instances are ordered, such that all the relational operators (<,<=,==,!=,>=,>) on references have meaning. No other operators are allowed.
string – Text appearing "inside quote marks". Strings are capable of limited operations. They can be compared with the relational operators (<,<=,==,!=,>=,>). The addition operator (+) concatenates two strings. Strings may also be concatenated with numbers. For example, "thing "+2 will become "thing 2".
identifiers - These are the names of parts and variables. Model files are stored in UTF-8 format, so they support a wide range of Unicode characters. Identifiers can start with any character in XID_Start. Subsequent characters can be any in XID_Continue, plus space (0x20). The only Medial character is full stop (0x2E), aka "dot".
Notice that space characters do not interfere with the basic expression syntax. Bob and Sue + Sally is a legal expression adding variable Bob and Sue with Sally. Spaces surrounding an identifier are ignored. Thus Bob and Sue+Sally is treated as exactly the same expression. Spaces internal to an identifier are significant, so BobandSue + Sally is a different expression. An identifier containing dots is essentially a path composed of several smaller identifiers. Spaces surrounding a dot in the middle of an identifier are ignored. Thus A . C is the same as A.C.
A variable name may end with any number of single-quote characters. These indicate the level of derivative. A'' is the second derivative of A.