Welcome to FeatureScript
FeatureScript guide
Language reference

Lexical Conventions

Tokens and Keywords

Identifiers follow the usual conventions: initial letter or underscore followed by alphanumeric or underscore. Letters are the 26 English letters, with upper and lower case distinct. (Examples reserve initial capitals for types and constants.) Identifiers prefixed with @ are reserved for functions provided by the runtime.

Characters other than 7 bit ASCII should only appear in comments or string constants. Variables can't be named smiley face.

Semicolons are never optional; they are required or not allowed. Newlines never substitute for semicolons.

Tab, newline, and carriage return serve equally as white space between tokens. FeatureScript does not care how much you indent bodies of conditionals. The optional auto-formatter will attempt to indent code following traditional rules.

Most of the usual C-style operator, expression, and grouping characters are used. For example += is a valid token. Pre- and post-increment and decrement operators (++ and --) are not supported. (They complicate overloading and make ordering harder to understand.)

Strings are in single or double quotation marks. Use backslash to escape a quotation mark of the same kind. A few backslash escapes are recognized: b, t, n, f, r, with meaning as in C. Unicode characters in string constants can be generated by \u followed by 4 hex characters, the same as in Java or JavaScript.

Numeric constants are decimal floating point numbers, e.g. 3e9 or 1.44, plus the special value inf for infinity. Negated constants are converted to negative constants.

FeatureScript has both C and C++ style comments, /* to */ or // to end of line. Comments are whitespace as in C or JavaScript rather than ignored as in TeX.

Keywords are

Unary operators are '-', '!', parentheses for grouping, and [] for box access.

Binary operators are + - * / % ^ ~ < > <= >= == != && ||. They have the usual meanings except ^ is used for exponentiation and ~ for string concatenation. Special operators are . and [] for container access, is for type checking, and as for type conversion.

Assignment operators are = += -= *= /= ^= %= ||= &&= ~=.

Programs may also contain , ? : :: { } ( ) [ ]. Other symbols, or sequences of symbols, are reserved.