The Mud Puddle

Home of Jon "evincarofautumn" Purdy

sol : syntax

Name

sol : syntax - Overview of basic Sol expression syntax

Synopsis

#! shebang line
#@ special comment
# comment
expr ;
expr ; expr ;
expr ; # comment
expr ; expr ; ... ; # comment
expr

Comments

Sol comments begin with the # character and continue to the end of line. This is to support systems that use the #! syntax for determining the application used to execute a source file. Multi-line comments are not supported. If a source file must be documented in detail then sol/solida, Sol's semi-built-in formatting language, should be used.

Comments beginning with the sequences #!, #@, ##, #$, #%, #^, #&, #*, #-, and #+ are significant to the formatter; see sol/solida for more details on the formatter and its commands.

Tokens

A token is a series of characters with Sol grammatical function. A source file is parsed into a series of tokens long before it is evaluated, so it important to know the rules that govern token splitting, namely:

  • Whitespace (see sol/space) always breaks tokens, except when it occurs in a quoted construct (e.g., ""foo"")
  • Unix-style newlines (\n) are newlines; carriage-returns (\r) are just whitespace.
  • Characters that always occur (outside quoted constructs) as separate tokens always break (e.g. (, ), ;). See sol/op for a list of these operators.
  • The longest token possible is always matched, so "foo.bar" produces the identifier "foo.bar", while "foo..bar" produces the expression "foo .. bar". See sol/guts for information on how the tokeniser operates.

Blocks

A block is any expression bracketed by the symbols { and }. Blocks are treated differently depending on context, but it is important to note that {} are treated as a single operator which returns a reference to the unevaluated expressions that it contains. This reference is passed to such operators as if and while or assigned with = to an identifier to produce different effects. Similar bracketing operators include [] and, yes, even ()

See Also

Built-in Operators ~ sol/op

Internationalisation ~ sol/intl

Style Guide ~ sol/style