Mango Syntax
Name Syntax Description
Example
<fragment>
A fragment is a segment of a source string
substring
{any character}*
A substring of text
"hello world!"
relation
"$" "(" <relation> ")"
Inserts a literal in the string
"Program version $(major_version).$(minor_version).$(revision)"
parameter
"#" "(" <literal:word> ")"
Insert a parameter into the string
"the parameter debug is #(debug)."
option
"~" "(" <literal:word> ")"
Inserts an option into the string
"the option build_name is ~(build_name)"
alias
"\" {any character}
an aliased character
"hello world!\n\n"
code
"$" "<" <literal:cardinal> ">"
Inserts a character into the string
"Print two ascii A's: $<64>$<64>"
<letter>
A letter is the character syntax
character
{any character}
A character
'A'
relation
"$" "(" <relation> ")"
Substitues a literal for the character
'$(tab_character)'
parameter
"#" "(" <literal:word> ")"
Subsitutes a parameter for the character
'#(eol)'
option
"~" "(" <literal:word> ")"
Subsitutes a option for the character
'~(tab_char)'
alias
"\" {any character}
an aliased character
'\n'
code
"$" "<" <literal:cardinal> ">"
Inserts a character by numeric code
'$<64>'
<literal>
A numeric, text or symbolic literal
binary
"#" {0 | 1 | _}
A binary literal
#1111_0000_1111_0000
signal
"\" {0 | 1 | z | x | Z | X | _}
A signal literal
\11z1_00x0_z1x0
decimal
{0 to 9 | _}* ["." {0 to 9 | _}*] ["E" ["+" | "-"] {0 to 9 | _}*]
A decimal literal
100.001E+90
hex
"$" {0 to 9 | A to F | a to f | _}*
A hex literal
$ffff_fe10_a000
quote
"\"" {<fragment>}* "\""
A string of fragments
"hello world! $(user_name) #(build_date) *(build_user) \n ${64}"
character
"'"<letter>"'"
A string of fragments
'\n'
cardinal
{1 to 9}*
A cardinal literal
1234
word
{A to Z | a to z} {A to Z | a to z | 1 to 9}*
A alpha-numeric literal
fx100
name
{A to Z | a to z} {A to Z | a to z | 1 to 9}*
A name of a built-in literal
<file^gt;
module
{A to Z | a to z} {A to Z | a to z | 1 to 9 | "/"}*
A name of a built-in literal
import sys/user;
block
 "{*" {any character}* "*}"
A block of text
{* 
   mv $ff, %eax;
   mv %eax, [%edi];
*}
<relation>
A symbol relation
namespace - keyword
<literal:word> "::" <literal:word>
a keyword in a namespace
system::file
namespace - keyword - extension
<literal:word> "::" <literal:word> "@" <literal:word>
an extension of a keyword in a namespace
system::file_type@read_write
alias
<literal:word>
an overloaded symbol name
print true;
keyword - extension
<literal:word> "@" <literal:word>
an extension of an overloaded keyword
file_type@read_write
keyword
<literal:word> "::" <literal:word>
an overloaded keyword
::file_type
extension
"@" <literal:word>
an overloaded extension
@true
<signifier>
An enclosed symbol
relation - open
<relation>
an open relation
system::file_type
relation - closed
"$(" <relation> ")"
an enclosed relation
$(system::file_type)
literal - open
<literal>
an open literal
$ffff_f1e0
literal - closed
"<" <literal> ["," <declaration>] ">"
an enclosed literal
<#1111_1010, cardinal/32>
definition - public
<literal:word>
an public definition
type count of cardinal/32;
definition - private
"(" <literal:word> ")"
an private definition
type (count) of cardinal/32;
import - primary
<literal:word>
an primary import
import sys/types;
import - secondary
"(" <literal:word> ")"
an secondary import
import (sys/types);
<term>
A term
word
<literal:word> {"," <literal:word>}*
a word
one, two, three
quote
<literal:quote> {"," <literal:quote>}*
a quote
"one, "two", "three"
unit
<literal:word> ["^" <literal:cardinal>] {"*" <literal:word> 
    ["^" <literal:cardinal>]}* 
a unit
seconds ^ 2 * mass * meter ^ 3
attribute
<literal:word> <literal:word> {"," <literal:word> <literal:word>}*
an attribute
conversion automatic, overflow wrapped
import
<signifer:primary> | <signifer:secondary> {"," {<signifer:primary> 
   | <signifer:secondary>}}*
a public or private import signifier
(sys/types), sys/io
module
<literal:word> "at" <literal:cardinal> {"," <literal:word> 
   "at" <literal:cardinal>}*
a module with version
sys/types at 3, sys/io at 4
relation
<signifier:relation-open> | <signifier:relation-closed> {"," {<signifier:relation-open>
  | <signifier:relation-closed>}*
a relation signifier
system::type, $(io::printable)
alias
<literal:word> "in" {<signifier:relation-open> | <signifier:relation-closed>}
 {"," <literal:word> "in" {<signifier:relation-open> | <signifier:relation-closed>}}*
a method alias
redraw in gtk::window, update in kde::frame
assumption
<assumption> {"," <assumption>}*
an assumption
a+1, max(b,c)
assignment
<literal:word> "=" <assumption> {"," <literal:word> "=" <assumption>}*
an assumption assignment
a=cos(<pi>), b=|c / d|
conversion
<assumption> "yields" <assumption> {"," <assumption> "yields" <assumption>}*
a conversion
"true" yields 1, "false" yields 0
condition
<assumption> [{"when" <assumption>} | ["otherwise"]]
   {"," <assumption> [{"when" <assumption>} | ["otherwise"]]}*
condition
a+1 when c >= 0, |a| otherwise
declaration
<declaration> {"," <declaration>}*
a declaration
cardinal/32, integer/32
case
<literal:word> "of" <declaration> {"," <literal:word> "of" <declaration>}*
case
a of integer/32, b of cardinal/32
lambda
<literal:word> ["of" <declaration>] {"," <literal:word> ["of" <declaration>]}*
lambda parameter
a of integer/32, b
function
[<literal:word> "of"] <declaration> {"," [<literal:word> "of"] <declaration>}*
function parameter
a of integer/32, cardinal/32
product
[<literal:word> ":"] <declaration> {","[<literal:word> ":"] <declaration>}*
product term
a: integer/32, cardinal/32
sum
<declaration> {"|" <declaration>}*
summation term
integer/32 | cardinal/32 | logical/boolean
<assumption>
An assumption is evaluated immediately by the compiler
relation
<signifier:relation-open> | <signifier:relation-closed>
a relation signifier
$(max_amount)
type_of
"type_of" <declaration>
the symbol of a type
type_of decimal {5:2}
literal
<signifer:literal-open> | <signifer:literal-closed>
a literal signifer
<pi, decimal {5:4}>
nil
"nil"
the nil (default) value
a == nil
option
"~" <literal:word>
an option
a if ~include_value else 0
parameter
"#" <literal:word>
a parameter
"test" if #debug else ""
invoke
<assumption> "(" {<term:assumption> | nothing} ")"
an invokation
a(1, 30)
lambda
"!(" <term:lambda> ") ->" <assumption>
a lambda definition
!(a, b) -> max(a,b)
switch
<assumption> "if" <assumption> "else" <assumption>
a simple selection statement
"true" if a == true else "false"
map
<assumption> "=> <term:assumption>
a value map
signal_value => "z", "0", "1", "x"
in
<assumption> "in" <assumption>
test when a term is in a set. Sets of character strings will automatically do a byte by byte comparision.
x in [1, 30, 100]
not_in
<assumption> "not_in" <assumption>
test when a term is not in a set. Sets of character strings will automatically do a byte by byte comparision.
x not_in [1, 30, 100]
aggregate
"[" <term:assumption> "]"
an product of assumptions values
[1, true, "joebob"]
group
"{" <term:assumption> "}"
a group of assumption values
a == {1, 30, 100}
replicate
"(" <assumption> ["," <assumption>] ")"
replicate a value a specified number of times. If no amount is specified, target value is passed as is.
('-', 80)
concat
<assumption> "&" <assumption>
concatenate two strings
"hello " & "world"
cast
<assumption> "as" <declaration>
cast a value to a type
1 as logical/boolean
to
<assumption> "to" <assumption>
create a range
x in 1 to 30
add
<assumption> "+" <assumption>
add two values
a + 1
identity
"+" <assumption>
The identity function. Tests if value is within expected range.
+a
subtract
<assumption> "-" <assumption>
subtracts one value from another
x - 30
negate
"-" <assumption>
negates a value
-x
multiply
<assumption> "*" <assumption>
multiply two values
a * 30
divide
<assumption> "/" <assumption>
divide one value by another
a / 30
apply
<assumption> "^" <assumption>
a value exponentially raised by another value
a ^ 2
absolute
"|" <assumption> "|"
an absolute value
|x - 30|
remainder
<assumption> % <assumption>
the remainder of a division
a % 30
divide_conserve
<assumption> // <assumption>
divide one value by another, conserving any remainder
a // 30
shift_left
<assumption> "$<" <assumption>
bitwise shift upward
a $< 4
shift_right
<assumption> "$>" <assumption>
bitwise shift downward
a $> 4
equal
<assumption> "==" <assumption>
equate two values
a == 30
not_equal
<assumption> "<>" <assumption>
differentiate two values
a <> 30
less
<assumption> "<" <assumption>
tests if one value is less than another
a < 30
less_equal
<assumption> "<=" <assumption>
tests if one value is less than or equal to another
a <= 30
greater
<assumption> ">" <assumption>
test if one value is greater than another
a > 30
greater_equal
<assumption> ">=" <assumption>
test if one value is greater than or equal to another
a >= 30
test
<assumption> "?"
test is value is true, or that a value is not equal to zero
a * b when length?,
a / b otherwise
not
"not" <assumption>
a logical or bitwise inversion
not a
and
<assumption> "and" <assumption>
a logical or bitwise product
a == true and b == true
or
<assumption> "or" <assumption>
a logical or bitwise union
a < 30 or a > 50
xor
<assumption> "xor" <assumption>
a logical or bitwise exclusive-or
a xor b
reduction
<assumption> "less" <assumption>
a logical or bitwise reduction (equivalent to a and not b)
a less b
<declaration>
A delaration is for type definitions
relation
<signifier:relation-open> | <signifier:relation-closed>
A symbolic type
$(system::type)
pseudo
"#" <literal:word>
a special type used by the compiler, including builtin functions
#any
pair
"<" <declaration> ["," <declaration>] ">"
a type pair, used for specifying addition argument for type construction
<byte, coordinate_2d> array
switch
<declaration> "if" <assumption> "else" <declaration>
a type selector
char/ascii if *mode=="ascii" else char/utf8
instance
<declaration> "instance"
creates a value of a reference type
my_record entry instance
bind
<declaration> "!"
creates a bounded type (ie the value of a reference type has a local duration)
handle!
logical
"logical" ["/" <literal:word>] ["having" <term:attribute>]
creates a logical type (binary, boolean, signal, etc)
logical/boolean having conversion automatic
void
"void" ["/" <literal:cardinal>] ["{" <assumption> "}"]
a void type of a particular alignment (in bits) and size (in bits)
void/32 {total_bytes*8}
ordinal
"ordinal" ["/" <literal:cardinal>] ["{" <assumption> "}"] ["having" <term:attribute>]
an ordinal type (origin zero upto specified maximum)
ordinal/32 {2^32-1} having overflow wrapped
character
"char" ["/" <literal:word>] ["having" <term:attribute>]
a text character type (ascii, utf8, utf16, utf32, etc)
char/ascii having overflow wrapped
register
"register" ["{" <assumption> [":" <assumption>] "}"]
  ["having" <term:attribute>]
a binary computational register
register {31:0} having overflow checked
signal
"signal" ["{" <assumption> [":" <assumption>] "}"]
  ["having" <term:attribute>]
a machine signal (four states: z, 0, 1, x}
signal {15:0} having overflow truncated
cardinal
"cardinal" ["/" <literal:cardinal>] ["{" <assumption> "}"] ["having" <term:attribute>]
a cardinal number (base 2) with specified size and precision (digits past the decimal point)
cardinal/32 {2} having conversion manuel
integer
"integer" ["/" <literal:cardinal>] ["{" <assumption> "}"] ["having" <term:attribute>]
an integer number (base 2, 2's complement) with specified size and precision (digits past the decimal point)
integer/32 {4} having overflow checked
subrange
"integer" ["/" <literal:cardinal>] ["{" <assumption> [":" <assumption> 
  [":" <assumption>]] "}"] ["having" <term:attribute>]
a subrange type with lower bound, default value, and upper bound
subrange/16 {-500, 0, 500} having overflow wrapped
rational
"rational" ["/" <literal:cardinal>] ["having" <term:attribute>]
a rational number (ratio of 2 integers)
rational/32 having conversion automatic
decimal
"decimal" ["/" <literal:cardinal>] ["{" <assumption> 
  [":" <assumption>] "}"] ["having" <term:attribute>]
a fixed point decimal type with encoding, whole digits and fractional digits
decimal/acd {10:2} having overflow checked
number
"number" ["/" <literal:cardinal>] ["having" <term:attribute>]
a floating point or unlimited precision number
number/32
volatile
<declaration> "?"
a volatile type
[byte?][30]
inert
<declaration> "inert"
an inert (non-volatile) type
[byte inert] string
immutable
<declaration> "+"
an immutable (read only) type
[ascii+] string
mutable
<declaration> "mutable"
a mutable type
[user_type mutable] string
shared
<declaration> "shared"
a shared (locked) type
integer shared
exclusive
<declaration> "exclusive"
a exclusive (locked) type
integer exclusive
unit
<declaration> "unit" <term:unit> ["per" <term:unit>]
a type with units
number/32 unit seconds * kilograms per meter ^ 2
scalar
<declaration> "scalar"
a type with no unit equation (magnitude only)
weight scalar
domain
<declaration> "domain" {"complex" | "real" | "imaginary" | "normal"}
a types relation to the complex domain
number/32 domain real
complex
<declaration> complex
a type in the complex domain
number/32 complex
endian
<declaration> "endian" <literal:word>
the byte order of a numeric type
cardinal/32 endian network
reverse
<declaration> "~"
a type with reverse byte order
cardinal/32~
product
"[" <term:product> "]"
a type product
[x: integer, y: integer, logical/boolean]
union
<declaration> "union"
the union of a type product
[i: integer/32, b: boolean, c: cardinal/16] union
local
"(" {<term:product> | <declaration>} ")"
a type or type product with local duration
(integer/32)
static
"{" {<term:product> | <declaration>} "}"
a type or type product with static duration
{integer/32, cardinal/32}
coordinate
<declaration> "coordinate" "{" <term:word> "}"
a coordinate type
number/64 coordinate {x,y,z}
matrix
<declaration> "matrix" "{" <assumption> [":" <assumption>] "}" 
a matrix type
integer matrix {3:2}
address
"address" ["{" <assumption> "}"]
address with bitwise alignment
address {8}
memory
<declaration> "memory" <literal:word>
the memory space of a type
[cardinal/32 memory io]'
reference-checked
<declaration> "&"
a checked reference
integer&
reference-unchecked
<declaration> "^"
an unchecked reference
integer^
pointer-checked
<declaration> "'"
a checked pointer
{integer}'
pointer-unchecked
<declaration> "#"
an unchecked pointer
integer#
sum
<term:sum>
a type sum
integer | cardinal | byte
variant
<declaration> "variant"
a variant type. This allows a type or any of it's subtype to share the same space
system::static_pointer variant
handle
"handle"
a universal pointer
handle
contents
<declaration> "contents"
the contents of a polymorphic type
handle contents
datum
<declaration> "datum"
a nullable type
integer datum
element
<declaration> "element"
a stoppable type. Used to signal the end of an iteration
integer element
string-variable
<declaration> "string"
a one dimensional variable sized string. strings always start at 1. strings accept pairs as arguments. left side of the pair is arrayed data type, right side of the pair is the coordinate system
<byte, cardinal/32> string
string-fixed
<declaration> "(" {<assumption> | "*"} ")"
a one dimensional fixed length string. "*" as length argument represents a string of arbitrary length. This is used for casting assumption strings.
byte(8)
array-variable
<declaration> "array"
a multi-dimensional variable sized array. arrays accept pairs as arguments. left side of the pair is arrayed data type, right side of the pair is the coordinate system
<cardinal/32, integer/32 coordinate {x,y}> array
array-fixed
<declaration> "[" <assumption>, [":" <assumption>] "]"
a multi-dimensional fixed sized array.
byte[[1,1]:[30,30]]
buffer-variable
<declaration> "buffer"
a variable sized buffer. buffers are strings with variable start and end points as well as wrap around functionality. buffers accept pairs as arguments. left side of the pair is arrayed data type, right side of the pair is the coordinate system
<byte, cardinal/32> buffer
buffer-fixed
"%(" <declaration>, <assumption> ")"
a fixed sized buffer
%(byte, 1024)
entry
<declaration> "entry"
entry is a linked list. entry can take two arguments. the left size is the data, the right side is the key.
user_record entry
segment
<declaration> "segment" ["{" <assumption> "}"]
a segment is linked with a variable size payload. Payload is arrayed as a string of some type.

list
<declaration> "list" ["{" <assumption> "}"]
a list of items. new items are appended at the end of the list. the numeric argument is the number of elements in each list segment.
integer list {1024}
stack
<declaration> "stack"
a stack. Stacks can take pairs as arguments. If a pair is specified, the stack becomes a priortized stack, and the right hand term is the priority of the datum.
<user_record, cardinal/32> stack
sequence
<declaration> "sequence" ["{" <assumption> "}"]
a sequence of items. new items are inserted at the begining of the sequence. the numeric argument is the number of elements in each sequence segment.

queue
<declaration> "queue"
a queue. Queues can take pairs as arguments. If a pair is specified, the queue becomes a priortized queue, and the right hand term is the priority of the datum.
<user_record, cardinal/32> queue
mask
<declaration> "mask"
a mask is a bitwise set of some finite number.
char/ascii mask
range
<declaration> "range"
a range is a pair of numbers that specify some numeric interval
number/32 range
set
<declaration> "set" ["{" <assumption> "}"]
a set of items. the numeric argument determines the size of the hash table. If a pair is given as the type argument, the set acts like a mapped set, translating the left hand term into the right hand term.
<ascii+ string, ascii+ string> set
table
<declaration> "set" ["{" <assumption> "}"]
a table of items. A table maps a group of items to a particular numeric key. The item and key are specified with a type pair. The right hand term is the data type, and the left hand term is the key. the number argument dtermins the size of the hash table.
<ascii+ string, cardinal/32> table
group
<declaration> "group"  ["{" <assumption> "}"]
a group is a set of items to which an equality can be made. the numeric argument is the size of the hash table
integer group {19}
graph
<declaration> "graph"  ["{" <assumption> "}"]
a graph records the frequency for some datum. graphs accept a type pair, with the left hand term defining the datum, and the right hand term defining the type used the record the frequency. the numeric argument is the size of the hash table.

function-global
<declaration> "->" <declaration>
a global function
[a: integer, b: integer] -> boolean
function-local
<declaration> "->>" <declaration>
a local (nested) function
[integer, integer] ->> [integer, boolean]
method-global
<declaration> "=>" <declaration>
a global method
integer => void
method-local
<declaration> "=>>" <declaration>
a local method
integer =>> integer
calling
<declaration> "calling" <literal-word>
the calling convention of a function
integer -> void calling gcc_c
method
<declaration> "method"
an unbound method. method accepts a type pair, with the left side defining the function, and the right side defining the data type bound to the method.
<integer => void, user_record< method
constant
<declaration> constant
a constant function. Constant functions are evaluated only once, after which the result is cached. The cached result is used for all subsequent calls.
char/ascii+ string constant
input
<declaration> "input"
an input method
integer input
output
<declaration> "output"
an output method
integer output
prototype
<declaration> "prototype"
a prototype method. prototype accepts a type pair, with the left side defining the function, and the right side defining the data type bound to the prototype method.
<integer => void, user_record> prototype
program
<declaration> "program"
a program. arguments are the input arguments of the program.
[args: [ascii+ string] string] program
file
<declaration> "file" ["/" <literal:word>]
a file
ascii file
text
<declaration> "text" ["/" <literal:word>]
a line oriented file
ascii text
stream
<declaration> "stream" ["/" <literal:word>]
a data stream
ascii stream
port
<declaration> "port" ["/" <literal:word>]
a connection port
ascii port
document
<declaration> "document" ["/" <literal:word>]
a document
user_record document
database
<declaration> "database" ["/" <literal:word>]
a database
user_record database
<destination>
A destination
anonymous
<literal:word>
an anonymous variable
some a in x
pair
"<" <literal:word> ["," <literal:word>] ">"
a pair of anonymous variables
every <value, key> in table
expression-open
<expression>
an expression
assign true into bitmask[x]
expression-closed
"(" <expression> ")"
an expression
foreach a in x over (b) do 
  ...
type-open
<literal-word> "of" <declaration>
a variable declaration
cast x into y of integer;
type-closed
"[" <literal-word> "of" <declaration> "]"
a variable declaration
some [a of ascii+ string] in x where a ~= "true"
term
<literal-word> "=" <expression>
an assignment term
a = x + 30
variable
"&" <literal-word>
an anonymous variable
assign y + 30 into &x
<detail>
Expression detail
iterator
{<destination:anon> | <destination:pair> | 
  <destination:type-closed> | <destination:expression-closed>} 
  "in" <expression> ["at" <expression> | "by <expression>]
  ["using" <signifier:relation>]
iterator element
every x in 1 to 30 by 3, y in my_table at h yielding [x,y]
condition
["over" {<destination:anon> | <destination:type-closed> | 
<destination:expression-closed>}] ["where" <expression>] ["while" <expression>] 
iterator condition
some x in y over [z of cardinal/32] where x > 30 while z < 100
slice
[{"from" <expression>} | {"upto" <expression>} |
  {"within" <expression>}]
array slice information
slice x from 1 to 30
alloc
[{"upto" <expression>} | {"within" <expression>} | [["with" <element:order>]  
["where" <element:named>}]]
allocation parameters
let a = new system_class with x, name 
  where min=30, max=100, mode=closed
spawn
"using" <signifer:relation> ["with" <element:ordered>] 
  ["where" <element:named>] 
spawn/fork parameters
spawn my_program with ["-f", "make", "mango"] where priority=19
copy
<expression> ["at" <expression> | "by" <expression>]
["using" <signifer:relation>]
copy parameters
copy x in y at h1 into p using my_iter
throw
["with" <element:ordered>] ["where" <element:named>]
throw parameters
throw system_error with ["unable to open file", filename]
read
["while" <element-ordered>] ["until" <element-ordered>]
read parameters
read [x of ascii list] from file until "\n"
function
<element:condition> ["of_type" <declaration>]
  ["such_that" <element:conversion> ["else" <expression>]]
  ["where" <element:named>]
function detail
function test 
  with ascii+ string string, integer/32 
  yielding logical/boolean is
    s[x] when x > 0,
    s[y] when y > 0,
    "x"  otherwise
  of_type
    ascii+ string
  such_that
    "true" yields true,
    "false yields false
           else   unknown
  where
     s = operand.1, x = operand.2, y = x + 100;
macro
<term:condition> ["of_type" <declaration>]
  ["such_that" <term:conversion> ["else" <assumption>]]
  ["where" <term:named>]
macro detail
macro test with a, b is
    a when s == "linux",
    b when s == "windows",
    "x"  otherwise
  of_type
    ascii+ string
  such_that
    "true" yields true,
    "false yields false
           else   unknown
  where
     s = #operating_system;
when
["when" <expression>]
terminal condition
quit when error == true
when-element
["when" <expression> ["else" <element-ordered>]]
terminal condition with alternative
print "hello", " ", name, "!" when name <> nil else "Hello user!"
when-expression
["when" <expression> ["else" <expression>]]
terminal condition with alternative
add name into set when name <> nil else "unknown user"
whenever
["whenever" <expression> ["else" <expression>]]
whenever terminal
fill [a of ascii string list] with x in y yielding x 
  whenever x? else "unknown user"
<element>
An element
named
<destination:term> {"," <destination:term>}*
an assigned expression
a = 1 + x
order
<expression> {"," <expression>}*
an expression list
x+1, a(x), z < b
aggregate
{<destination:term> | <destination:expression-open>}
   {"," {<destination:term> | <destination:expression-open>}}*
an labeled or unlabeled expression
[a=x+1, b=x/2, c=a(x)]
result
{<destination:variable> | <destination:expression-open>}
   {"," {<destination:variable> | <destination:expression-open>}}*
a result list
call compute with a,b into &c, x[i], f
and_then
<expression> {"and_then" <expression>}*
short circuit logical and
x <> nil and_then x.name == "joe"
or_else
<expression> {"or_else" <expression>}*
short circuit logical or
x == nil or x.flag == false
conversion
<expression> "yields" <expression> 
   {"," <expression> "yields" <expression>}*
conversion expression
"on" yields on, "off" yields off, "unknown" yields unknown
condition
<expression> [{"when" <expression>} | ["otherwise"]]
   {"," <expression> [{"when" <expression>} | ["otherwise"]}*
condition expression

iterator
<detail:iterator> {"," <detail:iterator>}*
iterator element

<expression>
A symbolic expression
relation
<signifier:relation-open> | <signifier:relation-closed>
a relation signifier
$(max_amount)
type_of
"type_of" <declaration>
the symbol of a type
type_of decimal {5:2}
literal
<signifer:literal-open> | <signifer:literal-closed>
a literal signifer
<pi, decimal {5:4}>
nil
"nil"
the nil (default) value
a == nil
option
"~" <literal:word>
an option
a if ~include_value else 0
parameter
"#" <literal:word>
a parameter
"test" if #debug else ""
invoke
<expression> "(" {<element:ordered> | nothing} ")"
an invokation
a(1, 30)
lambda
"!(" <term:lambda> ") ->" <expression>
a lambda definition
!(a, b) -> max(a,b)
switch
<expression> "if" <expression> "else" <expression>
a simple selection statement
"true" if a == true else "false"
map
<expression> "=> <element:ordered>
a value map
signal_value => "z", "0", "1", "x"
in
<expression> "in" <expression>
test when a term is in a set. Sets of character strings will automatically do a byte by byte comparision.
x in [1, 30, 100]
not_in
<expression> "not_in" <expression>
test when a term is not in a set. Sets of character strings will automatically do a byte by byte comparision.
x not_in [1, 30, 100]
aggregate
"[" <element:aggregate> "]"
an product of expressions values
[1, true, "joebob"]
group
"{" <element:ordered> "}"
a group of expression values
a == {1, 30, 100}
replicate
"(" <expression> ["," <assumption>] ")"
replicate a value a specified number of times. If no amount is specified, target value is passed as is.
('-', 80)
concat
<expression> "&" <expression>
concatenate two strings
"hello " & "world"
cast
<expression> "as" <declaration>
cast a value to a type
1 as logical/boolean
to
<expression> "to" <expression>
create a range
x in 1 to 30
add
<expression> "+" <expression>
add two values
a + 1
identity
"+" <expression>
The identity function. Tests if value is within expected range.
+a
subtract
<expression> "-" <expression>
subtracts one value from another
x - 30
negate
"-" <expression>
negates a value
-x
multiply
<expression> "*" <expression>
multiply two values
a * 30
divide
<expression> "/" <expression>
divide one value by another
a / 30
apply
<expression> "^" <expression>
a value exponentially raised by another value
a ^ 2
absolute
"|" <expression> "|"
an absolute value
|x - 30|
remainder
<expression> % <expression>
the remainder of a division
a % 30
divide_conserve
<expression> // <expression>
divide one value by another, conserving any remainder
a // 30
shift_left
<expression> "$<" <expression>
bitwise shift upward
a $< 4
shift_right
<expression> "$>" <expression>
bitwise shift downward
a $> 4
equal
<expression> "==" <expression>
equate two values
a == 30
not_equal
<expression> "<>" <expression>
differentiate two values
a <> 30
less
<expression> "<" <expression>
tests if one value is less than another
a < 30
less_equal
<expression> "<=" <expression>
tests if one value is less than or equal to another
a <= 30
greater
<expression> ">" <expression>
test if one value is greater than another
a > 30
greater_equal
<expression> ">=" <expression>
test if one value is greater than or equal to another
a >= 30
test
<expression> "?"
test is value is true, or that a value is not equal to zero
a * b when length?,
a / b otherwise
not
"not" <expression>
a logical or bitwise inversion
not a
and
<expression> "and" <expression>
a logical or bitwise product
a == true and b == true
or
<expression> "or" <expression>
a logical or bitwise union
a < 30 or a > 50
xor
<expression> "xor" <expression>
a logical or bitwise exclusive-or
a xor b
reduction
<expression> "less" <expression>
a logical or bitwise reduction (equivalent to a and not b)
a less b
field
<expression:term> "." <literal:word>
field selection
assign true into user_record.flag
term
<expression:term> "." <literal:cardinal>
term selection
assign true into user_record.3
attribute
<expression> ":" <literal:word>
an attribute (data field) of an abstract type
assign true into user_class.flag
attribute-local
"." <literal:word>
accesses an attribute (data field) for the target type of a method
assign .user_name into result
select
<literal:word> "of" <expression>
find a method for a particular type
assign length of t into result
method-local
"!" <literal-word>
finds a peer method for the target type of a method
call !init with x, 30
index
<expression> "[" <expression> "]"
index an array
some_array[30 + x]
slice
"slice" <expression> <detail:slice>
slice an array
slice some_array from x to x + 30
array-equal
<expression> "~=" <expression>
compares the contents of a pair of arrays for equality
args[1] ~= "iso9660"
array-notequal
<expression> "/=" <expression>
compares the contents of a pair of arrays for inequality
args[1] /= "iso9660"
size
<expression> "size"
the size of some aggregate type
user_list size
domain
<expression> "domain"
the dimensions of an array
user_space domain
cast-dynamic
<expression> "!"
a dynamic (infered) cast
assign x! + y into &z
interface
"%" <expression>
finds an interface for a type
print "x = ", %x, eol
eval
"^" <expression>
evaluates an expression. This can be used to derefence a pointer, or access the contents of a polymorphic type.
assign ^handle1 into ^handle2
type
<expression> "type"
the type of the current value of a polymorphic type
^x if x type == user_record else nil
sentry
<expression> "sentry"
the sentry of a pointer type
assign xptr sentry into &xs;
datum
"datum" <declaration> [<detail:alloc>]
create a local value of some type (value is placed on the stack)
datum <ascii string, boolean> set {19} with "joe" -> true, 
  "sally" -> false, "jim" -> true, "bill" -> false
correlate
<expression> "->" <expression>
create an anonymous product pair
print left_format -> "name", center_format -> "total"
reserve
reserve <declaration>
reserve a type on the static heap, and return a pointer to it
reserve field entry instance
provide
provide <declaration> "from" <expression>
provide a type from an arena (arbitrary duration)
provide field entry from main_arena
get
get <declaration> <detail:alloc>
get a type from the static head. autmatically instantiate reference types.
get user_class with x, "system" where mode=full
new
new <declaration> "from" <expression>
  <detail:alloc>
get a type from an arena (arbitrary duration). Automatically instantiate reference types.
new field entry from main_arena where type = init, data = x
and_then
<expression> "and_then" <expression>
short circuited logical and
x <> nil and_then x.field == true
or_else
<expression> "or_else" <expression>
short circuited logical or
x == nil or_else x.field == false
is
<expression> "is" <expression>
applys argument on the left to test function (returning a boolean) on the right
x is alpha_numeric
is_not
<expression> "is_not" <expression>
applys argument on the left to the test function on right, inverting the result
x is_not alpha_numeric
like
<expression> "like" <expression>
polymorphic type on the left is compatible with the type on the right
x like user_interface
not_like
<expression> "not_like" <expression>
polymorphic type of the left is not compatible with the type on the right
x not_like user_interface
pick
"pick" <element:iterator> <detail:condition> 
  ["yielding" <expression> ["else" <expression>]]
pick a value from a set
pick x in list where x > 30 yielding x^2 else 0
every
"every" <element:iterator> <detail:condition> 
  ["yielding" <expression>]
populate an aggregate with selected values
every x in 1 to 30 where even(x) yielding x^2
some
"some" <element:iterator> <detail:condition>
evaluates to true if some member of a group satisfies a condition
print "on" when some x in group where x is on
all
"all" <element:iterator> <detail:condition>
evalutes to true if every member of a group satisfies a condition
print "all ready" when all x in group where x is on
product
"product" <element:iterator> <detail:condition> 
  ["yielding" <expression>]
takes the product of the iterative results
let fac = product x in 1 to 30 yielding x
sum
"sum" <element:iterator> <detail:condition> 
  ["yielding" <expression>]
takes the sum of the iterative results
let sum_of_squares = sum x in 1 to 30 yielding x^2
throw
"throw" <signifier:relation> <detail:throw> 
throws an exception
throw system_error with ["unable to open file", filename]
require
"require" <expression> ["else" <expression>]
assertion statement. Evaluates "else" if condition is false.
require a > b before x(a,b)
pause
"pause"
pause the program
pause before x(a,b)
quit
"quit"
quit the program
quit after x(a,b)
before
<expression> "before" <expression>
execute statement on the left before evaluating expression on the right
pause before x(a)
after
<expression> "after" <expression>
execute statement on the left after evaluating expression on the right
pause after x(a)
<aggregate>
A statement aggregate
declare
<term:word> "of" <declaration> 
  ["where" <element:named>] ";"
declares a local variable
declare x,y of integer where x = -1, y = 1;
allocate
<destination:type-open> <detail:alloc> ";"
allocate a localized variable onto heap. Type is automatically deleted when scope is left
allocate buf of byte buffer upto buf_size;
get
<destination:type-open> <detail:alloc> ";"
create a local variable that points to a newly created type on the static heap
get ptr of user_class where name = user_name, age = user_age;
new
<destination:type-open> <detail:alloc> ";"
create a local variable that points to a newly created type within an arena
new ptr of user_class from arena 
  with user_name, user_age;
delete
<element:ordered> [<detail:when>] ";"
delete an item.
delete ptr when ptr?;
trash
<element:ordered> ";"
trashes a type along with it's sentry
trash user_stat_ptr;
overlay
<destination:type-open> "onto" <expression> ";"
overlays one type onto of another. types must be of same size and compatible alignment
overlay x of [register {15:0}, register {15:0}]
 onto cardinal_number;
create
<destination:type-open> "onto" <expression> ";"
creates a new type within some arrayed type. A buffer can consist of a simple string or a segment of sufficient length. In the case of segments, index variables will be automically advanced
create x of my_record 
map
<destination:type-open> "with" <expression> ";"
maps a device to a particular address
map x of io_device with io_base_address + $ff
place
<destination:type-open> "at" <expression> ";"
positions a type at a particular address.
place byte(256) at posted_mail address
open
{<destination:type-open> | <destination:expression-closed>}
  ["where" <element-named>] ";"
open an io device (file, port, database, etc)
open fp of ascii file where path = "/etc/user.conf";
close
<element-ordred> [<detail-when>]
close an io device
close fp1, fp2;
assign
<element-ordered> "into" <element-result> 
  [<detail:when-element>] ";"
assign a value to some variable
assign x+1 into y when x > 0 else 0;
swap
<expression> "with" <expression>
  [<detail:when>] ";"
swaps two values
swap x with y;
reset
<element:ordered> [<detail:when>] ";"
resets a value
reset v1, v2;
set
<element:ordered> [<detail:when>] ";"
sets a value to 1 (or an approximation thereof)
set v1, v2 when setem == true;
increment
<element-ordered> "with" <expression> [<detail:when>] ";"
increment a value
incr x, y with 1;
decrement
<element-ordered> "with" <expression> [<detail:when>] ";"
decrement a value
decr x with y when user is ready;
reduce
<element-ordered> "with" <expression> [<detail:when>] ";"
reduce (divide down) a value
reduce x with 2;
magnify
<element-ordered> "with" <expression> [<detail:when>] ";"
magnify (multiply up) a value
magnify x, y with z;
evaluate
<element-ordered> "with" <expression> 
  ["into" <element-ordered>] [<detail:when-element>] ";"
evaluate a value product with a function
evaluate x, y with compute_area into &z;
call
<expression> ["with" <element-ordered>] 
  ["into" <element-ordered>] [<detail:when-element>] ";"
calls a function
call user_func with x,y when active == true
initialize
<expression> [<detail:throw>] [<detail:when] ";"
initializes a class

finalize
<element-ordered> [<detail:when] ";"
finalize a class
finalize cls_x, cls_y;
define
<literal:word> ["with" <term:function>]
  ["yielding" <term:function>] ["as" (block<statement>)]
defines a nested function
define x with integer yielding boolean as
  return operand > 30;
implement
<literal:word> "as" (block<statement>)
implement a nested function
implement x as
  return operand > 30;
spawn
{<destination:var> | <destination:expression-open>}
<detail:spawn> [<detail:when>] ";"
spawn a program in same memory space
spawn &pg using user_thread with user_args where priority=high;
fork
{<destination:var> | <destination:expression-open>}
<detail:spawn> [<detail:when>] ";"
fork a program in seperate memory space
fork &pg using user_program with args;
kill
<element:ordered> [<detail:when>] ";"
kill a program
kill pg1, pg2 when mode=kill;
signal
<expression> ["where" <element:named>] [<detail:when>] ";"
send asynchronous signal to a program
signal pg1 where type=sighup
add
<element:ordered> ["at" <expression>]
  "into" <expression> [<detail:when-element>] ";"
add an item into an aggregate
add 17, 19 into prime_set;
replace
<expression> ["at" <expression>]
  "from" <expression> "with" <expression>
  [<detail:when-expression>] ";"
replace an item in an aggregate with another item
replace x from user_set with y;
remove
<element-ordered> ["at" <expression>]
  "from" <expression> [<detail:when-element>] ";"
remoave an item from an aggregate
remove x from user_set;
take
<element-result> ["at" <expression>]
  "from" <expression> [<detail:when-element>] ";"
take an item out of an aggregate
take &x from some_stack 
  when some_stack size > 0 else def_x; 
trim
<expression> "with" <expression>
[<detail:when-expression>] ";"
reduce set by another set

filter
<expression> "with" <expression>
[<detail:when-expression>] ";"
"and" a set with another set

find
<detail:iterator> <detail:condition> 
["else" <expression> | "else_insert" <expression>] ";"
find an item in an aggregate
find x in y where x.name == name
  else_insert get user_record where name = name;
extract
<detail:iterator> <detail:condition> 
["else" <expression>] ";"
extract an item from an aggregate
extract x from y where x.name == name;
fill
{<destination:type-closed> | <destination:expression-closed>
  | <destination:anon>} "with" <detail:iterator> <detail:condition> 
["yielding" <expression>] [<detail:whenever>] ";"
fill a set with an iterator
fill [x of integer set] with y in 1 to 30 yielding y^2;
compute
{<destination:type-closed> | <destination:expression-closed>
  | <destination:anon>} "with" <detail:iterator> <detail:condition> 
["yielding" <expression>] [<detail:whenever>] ";"
take the arthimatic sum of an iteration
compute h with s in list yielding hash_code(s);
modify
<detail:iterator> <detail:condition> 
["with" <expression>] [<detail:whenever>] ";"
modify a value in an aggregate
modify x in y with x^2;
copy
{<destination:type-closed> | <destination:expression-closed>
  | <destination:anon>} "from" <detail:copy> "into" <detail:copy> 
<detail:condition> ["with" <expression>] [<detail:whenever>] ";"
copy a value from one aggregate to another
copy x from list1 into list2;
write
<expression> "with" <element:ordered> 
  [<detail:when-element>] ";"
write to some target
write stderr with "system failed:", msg, eol;
read
{<destination:type-closed> | <destination:expression-closed>
  | <destination:anon>} ["from" <expression>] [<detail:read>] ";"


print
<element:ordered> [<detail:when-element>] ";"
print to standard out
print "hello", " ", "world!", eol
log
<expressiona> "with" <element:ordered> [<detail:when-element>] ";"
atomic write. All arguments are pass in one function call.
log [lg, error] with "unable to find file ", filename, ".";
accept
{<destination:var> | <destination:expression-open>}
  "from" <expression> ";"
accept a stream from a port
accept &stream from port;
monitor
<element:ordered> ["for" <expression>] 
  "into" {<destination:var> | <destination:expression-open>} ";"
monitor a port for some time period. active ports are put into a result list.
monitor x, y, z for 100 into &list;
query
<expression> "where" <expression>
  "with" <expression> "into" {<destination:var> | 
  <destination:expression-open>} ";"
query a database. Put result into a list.
query db where ["name == "\"" , name, "\""] 
  with arena into &rs_list;
update
<expression> "where" <expression>
  "with" <expression> ";"
update a record in a database
update db where "name == joe" with rec;
insert
<expression> "into" <expression> ";"
insert a record into database
insert rec into db;
command
<expression> "with" <expression> ";"
send a command to a database
command db with "delete name == joe";
dump
<expression> "with" <expression> 
  "into" <expression> ";"
dump all records from a database
dump db with arena into &reclist;
load
<expression:term>


activate
<signifier:relation> 
  "with" <element:ordered> ";"
activate a handler
activate system::handler with arg;
require
<expression> ["else" <expression>] ";"
assertion statement
require x? else throw ParameterError 
  with "x == null";
throw
<signifier:relation> <detail:throw> ";"
throw an exception
throw SystemError with "out of memory";
value
"case" <element:ordered> "do" 
  block(<statement>)
a value case
case 30, true, "joe" do
  ...
type
"case" <term:case> "do" 
  block(<statement>)
a type case
case a of integer, b of cardinal do
 ...
input
<expression> "into" <literal:word> ";"
input to an foreign code block
as "asm" do
  input
    x into eax;
  output
    eax into (x);
  over 
    {*
     ...
    *};
output
lt;literal:word> "into" <destination:> "into" 
  {<destination:anon> | <destination:type-closed> | 
  <destination:expression-closed>} ";"
output of a foreign code block
as "asm" do
  input
    x into eax;
  output
    eax into (x);
  over 
    {*
     ...
    *};
<statement>
A statement
execute
"execute" block(<statement>)
a statement block
execute
  print "hello", eol;
  print "world", wol;
as
"as" <assumption> "do"
input block(<aggregate-input>)
output block(<aggregate-output>)
over <literal:block> ";"
a foreign block
as "asm" do
  input
    x into eax;
  output
    eax into (x);
  over 
    {*
     ...
    *};
exit
"exit" ["/" <literal:word>] [<detail:when>] ";"
exit a block
exit/function when mode == active;
return
"return" <element:ordered> [<detail:when>] ";"
return a result from a function
return x,y,z;
continue
"continue" ["/" <literal:word>] [<detail:when>] ";"
continue a loop
continue/loop when x > 0;
repeat
"repeat" block(<statement>)
repeate a loop endlessly
repeat
  print "hello word!", eol;
declare
"declare" block(<aggregate:declare>)
declares a local variable
declare x,y of integer where x = -1, y = 1;
allocate
"" block(<aggregate:>)
allocate a localized variable onto heap. Type is automatically deleted when scope is left
allocate buf of byte buffer upto buf_size;
get
"get" block(<aggregate:get>)
create a local variable that points to a newly created type on the static heap
get ptr of user_class where name = user_name, age = user_age;
new
"new" block(<aggregate:new>)
create a local variable that points to a newly created type within an arena
new ptr of user_class from arena 
  with user_name, user_age;
delete
"delete" block(<aggregate:>)
delete an item.
delete ptr when ptr?;
trash
"trash" block(<aggregate:trash>)
trashes a type along with it's sentry
trash user_stat_ptr;
overlay
"overlay" block(<aggregate:overlay>)
overlays one type onto of another. types must be of same size and compatible alignment
overlay x of [register {15:0}, register {15:0}]
 onto cardinal_number;
create
"create" block(<aggregate:create>)


map
"" block(<aggregate:>)


place
"" block(<aggregate:>)


open
"" block(<aggregate:>)


close
"" block(<aggregate:>)


assign
"" block(<aggregate:>)


swap
"" block(<aggregate:>)


let



refine
<expression:term>


touch



nothing
<expression:term>


reset
"" block(<aggregate:>)


set
"" block(<aggregate:>)


increment
"" block(<aggregate:>)


decrement
"" block(<aggregate:>)


reduce
"" block(<aggregate:>)


magnify
"" block(<aggregate:>)


eval
"" block(<aggregate:>)


call
"" block(<aggregate:>)


initialize
"" block(<aggregate:>)


finalize
"" block(<aggregate:>)


define
"" block(<aggregate:>)


implement
"" block(<aggregate:>)


spawn
"" block(<aggregate:>)


fork
"" block(<aggregate:>)


kill
"" block(<aggregate:>)


signal
"" block(<aggregate:>)


await
"" block(<aggregate:>)


detach
"" block(<aggregate:>)


if
<expression:term> "" block(<aggregate:>)


select
"" block(<aggregate:>)


when
"" block(<aggregate:>)


during
<expression:term> "" block(<aggregate:>)


while
<expression:term> "" block(<aggregate:>)


until
<expression:term> "" block(<aggregate:>)


where
<expression:term> "" block(<aggregate:>)


convert
<expression:term> "" block(<aggregate:>)


given
<expression:term> "" block(<aggregate:>)


cast
<expression:term> "" block(<aggregate:>)


foreach
<expression:term> "" block(<aggregate:>)


acquire
<expression:term> "" block(<aggregate:>)


add
"" block(<aggregate:>)


replace
"" block(<aggregate:>)


remove
"" block(<aggregate:>)


take
"" block(<aggregate:>)


trim
"" block(<aggregate:>)


filter
"" block(<aggregate:>)


find
"" block(<aggregate:>)


extract
"" block(<aggregate:>)


fill
"" block(<aggregate:>)


compute
"" block(<aggregate:>)


modify
"" block(<aggregate:>)


copy
"" block(<aggregate:>)


write
"" block(<aggregate:>)


read
"" block(<aggregate:>)


print
"" block(<aggregate:>)


log
"" block(<aggregate:>)


accept
"" block(<aggregate:>)


monitor
"" block(<aggregate:>)


query
"" block(<aggregate:>)


update
"" block(<aggregate:>)


insert
"" block(<aggregate:>)


command
"" block(<aggregate:>)


dump
"" block(<aggregate:>)


load
<expression:term>


activate
"" block(<aggregate:>)


try
<expression:term> "" block(<aggregate:>)


require
"" block(<aggregate:>)


throw
"" block(<aggregate:>)


quit
<expression:term>


pause
<expression:term>


<feature>
A feature
method
<expression:term>


functor
<expression:term>


attribute
<expression:term>


receptor
<expression:term>


parameter
<expression:term>


property
<expression:term>


state
<expression:term>


share
<expression:term>


annex
<expression:term>


request
<expression:term>


requirement
<expression:term>


invariant
<expression:term>


header
<expression:term>


footer
<expression:term>


datum
<expression:term>


feature
<expression:term>


<group>
A feature group
method
<expression:term>


functor
<expression:term>


attribute
<expression:term>


receptor
<expression:term>


parameter
<expression:term>


property
<expression:term>


state
<expression:term>


share
<expression:term>


annex
<expression:term>


request
<expression:term>


requirement
<expression:term>


invariant
<expression:term>


prelude
<expression:term>


finale
<expression:term>


constructor
<expression:term>


destructor
<expression:term>


datum
<expression:term>


feature
<expression:term>


<definition>
A definition
type
<expression:term>


alias
<expression:term>


literal
<expression:term>


macro
<expression:term>


scalar
<expression:term>


enum
<expression:term>


variable
<expression:term>


dataset
<expression:term>


procedure
<expression:term>


program
<expression:term>


function
<expression:term>


constant
<expression:term>


record
<expression:term>


abstract
<expression:term>


structure
<expression:term>


medley
<expression:term>


device
<expression:term>


packet
<expression:term>


class
<expression:term>


interface
<expression:term>


object
<expression:term>


prototype
<expression:term>


exception
<expression:term>


handler
<expression:term>


conversion
<expression:term>


operator
<expression:term>


reader
<expression:term>


writer
<expression:term>


iterator
<expression:term>


mutex
<expression:term>


symbol
<expression:term>


external
<expression:term>


component
<expression:term>


constructor
<expression:term>


template
<expression:term>


instance
<expression:term>


include
<expression:term>


import
<expression:term>


promote
<expression:term>


access
<expression:term>


exclude
<expression:term>


admit
<expression:term>


option
<expression:term>


parameter
<expression:term>


target
<expression:term>


build
<expression:term>


library
<expression:term>


archive
<expression:term>


<directive>
A directive
<expression:term>


<prefix>
A prefix
module
<expression:term>


profile
<expression:term>


manifest
<expression:term>


header
<expression:term>


platform
<expression:term>


assembly
<expression:term>


<suffix>
A suffix
module
<expression:term>


type
<expression:term>


parameter
<expression:term>


option
<expression:term>


source
<expression:term>


product
<expression:term>


<tree>
A tree
tree
<prefix> {<directive>}* ["requires" {<suffix>}*]
The top level tree
module xyz;

import abc;

procedure test;

requires
  module abc at 4;