This page completely describes the basic syntax for representing the structure of a structured expression. On top of this syntax is added a set of operators from a notation definition, and the names and meanings of the compounds are defined by a context definition. The known context definitions in their current state are given on the context pages.
MINSE is a simple specification language that recognizes just two special characters to express structure, the single-quote and the comma:
' ,
MINSE also recognizes and groups expressions using parentheses:
Your parentheses must match. Parentheses are to be used only to convey grouping (which also implies precedence). (That is, they may not imply meaning of their own, the way round parentheses sometimes mean an open interval, for example. To express a particular construction or operation, you use a compound.)( )
To represent symbols that cannot be normally
typed and to identify text that has meaning,
we use the question mark ("?
").
Also, for future use in defining and expanding macros (not implemented yet),
the at-symbol ("@
") is reserved. In the interests of minimalism,
i tried to keep the number of special characters as small as possible.
Although it will be quite rare, if you wish to use any of these six characters literally for some reason (e.g. an unmatched parenthesis), you must "paralyze" or "escape" it by preceding it with a quote, as in:
Notice that this means the at-symbol may never appear "unescaped" in any expression. It is currently the one character with this property.'' ', '( ') '? '@
The rest of the characters in a MINSE expression should be printable ISO-Latin-1 characters (that is, letters, digits, punctuation marks, or typographical symbols).
The conceptual structure of any MINSE expression is a tree-like hierarchy. Present in the expression are a number of elements, each of which may further contain sub-elements, and so on. For example, the expression
'deriv('exp(x,2),x)
contains one top-level element, a derivative compound,
which has two sub-elements, an exponential compound
and the identifier x. The exponential
compound further contains two sub-elements, the identifier
x and the number 2. To make this
structure apparent, it is displayed here in a more tree-like form:
'deriv('exp(x, 2 ), x )
Every valid MINSE expression consists of exactly one top-level element. Elements are never simply concatenated or juxtaposed; thus the relationship between any parts of an expression is always well-defined.
There are exactly three kinds of things that stand on their own as elements: numbers, identifiers, and text.
A number is an unbroken sequence of digits, possibly including one period, which is possibly followed by a letter "E" (either uppercase or lowercase) and some more digits. A number always begins with a digit (it may not begin with the period). (Negative numbers are expressed by placing an underscore in front of a number; strictly speaking, the underscore is not part of the number but rather an operator that negates the number.) A number has the obvious semantic meaning.
An identifier is an unbroken sequence of any letters or digits, as long as the sequence does not start with a digit or a period. Symbols may be embedded in identifiers. The implied semantic meaning is that the identifier directly stands for a concept (like a variable, a function, a chemical, and so on).
If a concept needs to be expressed in prose, you should use text. Text consists of an arbitrary string (with the restriction that if any parentheses are present, they must match) enclosed in one pair of parentheses which is immediately preceded by a question mark. To use any of the six special characters literally within text, it should be preceded by a single-quote as described above (this is probably where you will most often need to escape anything). Text may contain meaningful MINSE expressions if each expression is enclosed in parentheses immediately preceded by a question mark (the same way expressions contain text).
Text is given a distinct notation because its presence implies that the information conveyed by the expression is not entirely machine-readable. For example, you could use text like this:
In theory, any MINSE expression that does not contain a question mark immediately followed by a left-parenthesis should be processable (in a fairly complete and meaningful sense) by a computer without human aid.':set(S) = ?(the set of roots of ?(x^2 = 3))
You use the quote, together with the parentheses and the comma, to form MINSE compounds, whose meaning is defined by the chosen context. (In a mathematical context, for instance, compounds would include the familiar mathematical operators and functions.) When a quote is followed by a string of letters (possibly containing periods), the string is interpreted as the name of the compound.
Compound names are case-sensitive. If the compound has sub-elements, you supply them (immediately following the compound name) within the parentheses, separated by commas. For example:
'integ(f(x),x,0,'inf)
invokes the integ
compound (for "integral") with the four
sub-elements f(x)
, x
, 0
, and
'inf
. The last of these sub-elements is another
compound, inf
(for "infinity"), and it doesn't have any
sub-elements.
Notice an important distinction with regard to sub-elements:
is a compound named'waffle
waffle
with no sub-elements, while
and'waffle()
are both compounds named'waffle(a)
waffle
with one
sub-element. In the first of these two cases the one sub-element is an
empty string (this possibility is left open in case a meaning can be
defined for such a situation in a given context).
is a compound named'waffle(a,b)
waffle
with two sub-elements, and so on.
Succinctly: if parentheses are present, the number of sub-elements is
always one plus the number of commas; and if there are no parentheses,
there are no sub-elements.
As well as the uppercase and lowercase letters of the alphabet, the
colon is permitted as the first character of a compound and it has a
special meaning by convention: such compounds are called types.
They do not construct or transform anything, but only label their
element as as being a particular kind of thing, such as a vector, matrix,
or unit. For instance, a variable labelled with the ':vector
type might be visually rendered with a small arrow on top, or in boldface.
These compounds always take one sub-element, and the colon naming
convention keeps them distinct from the names of compounds.
This is how we tell the difference between, say, the
set type, where ':set(A)
means "the
set named A", and the set compound, where
'set(a, b, c)
assembles the elements a
,
b
, and c
into a set of three elements.
But what do these compounds do? Well, their exact operation
depends on the chosen method of presentation. For example, using a
mathematical style definition, a graphical rendering of the integ
compound would probably draw an integral symbol and place the limits of
integration at the top and bottom of the symbol. But an audio rendering
would likely say something like "the integral, for x from zero to
infinity, of f of x". The precise rendering is not something you need
to worry about; the important point is that the integ
compound
will always mean an integral in a math context no matter how the expression
is rendered.
Some extra mechanism is needed to represent symbols that cannot be normally typed, but which also have no fixed operational or semantic meaning. These symbols are liable to be inserted anywhere in identifiers or text, so they cannot be specified in the same manner as compounds. To get a symbol, enclose a symbol name in question marks. A symbol name consists of an unbroken string of letters or digits. So, for instance, while
could mean the Gamma function in a mathematical context,'Gamma(x)
refers to a capital gamma as just the Greek letter and no more. Symbols are semantically treated a parts of identifiers (like any ordinary alphabetic letter). Their appearance is defined by the chosen style. Many symbols, such as those for other languages, are common to all styles, and these are listed on the common context reference page.?Gamma?