Introduction
Notation
Accessors
Commands
Grammar
Comments are notes for humans to read and are ignored by the parser.
// single line comment
/* multi line comment */
All cards are indexed data structures (map or trie when size > 256) and all cards are derived from an empty card {}
.
All lists are linked lists and all lists are derived from an empty list []
.
All primitive values are arrays, all arrays are byte arrays, and all arrays are derived from an empty array [:]
.
Cards can be assigned to a key to more easily identify them.
Lists can contain multiple types of whitespace delimited cards and values.
my_list: [ 1 2 "A" "B" "Hello" [3 4]]
An ordered list of commands may be created from the characters between (- )
or (= )
.
commands: (-
print "this"
print "that")
// the first item in "commands" is
// the string 'print "this"'
If executed, the commands between (- )
will be executed serially in the listed order.
In contrast, the commands between (= )
will be evaluated concurrently as permitted by the chip architecture.
Program execution does not move on from the list until all commands have been evaluated.
Arrays can contain only one type of fixed size data.
The type of an array's data may be specified.
The length of an array's data may be specified, but if not then it will be assumed to only encompass the specified data.
Since lists are not fixed size data they cannot be placed in an array.
However lists can be initialized as a struct which cannot be extended and may therefore be placed in an array of similarly structured elements.
struct: {: 1 "John" "Doe"}
Character strings and integer strings are automatically implemented as arrays.
string: "string"
// equivalent to str /[:"s" "t" "r" "i" "n" "g"]
integer: 511
// equivalent to int /[:255 1]
If not specified, strings default to ascii, but ascii and unicode strings can both be implemented with their shorthand.
string1: "string"
string2: str /"string"
unicode_string: ustr /"string"
// the first 2 strings become ascii strings
Strings can be enclosed in ''
, ""
, ``
, and <<>>
.
[
'string'
"string"
`string`
<<string>> ]
Strings enclosed in quotation marks can escape the quotation marks by doubling them up.
[
'strings''s'
"string""s"
`string``s` ]
If not specified, numbers with decimals points default to the dec
type, but float
and double
types can both also be implemented by specifying their type.
The dec
type is implemented using a byte array like a string, where each byte is an int representing 2 digits.
Unlike the int
type, dec
, float
, and double
numbers may be either positive or negative.
number1: 12.34
number2: dec /12.34
float_number: float /12.34
double_number: double /12.34
// the first 2 numbers become decimal types
// the third becomes a floating point number
// the fourth becomes a double
Keys in a card's index that are not paired with a value are also referred to as tags.
The body must always appear last.
type{ tag keys:values /body}
int /[:1 2]
Key-value pairs can be fixed (like a const variable) so that they return void (or an error or null value depending on reader implementation) if deletion or any change to the pair is attempted.
{ key1: "data" key2:: "constant data"}
Key-value pairs can be created using a copy of another key's value.
Keys can be path references to the cards referenced by other keys,
but will return void (or an error or null value depending on reader implementation) if the referenced card has been deleted before attempting to access it.
Keys can be binding references to the cards referenced by other keys,
but will return void (or an error or null value depending on reader implementation) if deletion of the referenced card is attempted while a binding reference to it still exists.
Binding references are prohibited from referencing cards in child scopes, and attempting to do so will result in an interpreter/compiler error.
Keys can specify a list or array of one type of references, by placing the keys in question in a list or array.
{key1: data1 key2: data2 key3:& [key1 key2] }
Additional Example Data
[:
[:0 0]
[:1 1]
[:2 2]]
[
[:0 0]
[:1 1]
[:2 2]
["three" "four"]
[:"four" "five"]
["five" 5]]
[
{ first_name: "John"
last_name: "Doe"
orders_placed: 4500}
{ first_name: "Jane"
last_name: "Doe"
orders_placed: 2300}]
book{
reference
nonfiction
philosophy
author: "Splato"
title: "For Me"
table_of_contents: [
row{ section title:"The Beginning" page: 1}
row{ section title:"The Middle" page: 50}
row{ section title:"The End" page: 100}]
/[
page{ section_start heading: "The Beginning" /[
"In the beginning there was nothing..."
"... which is why there must be something. Otherwise everything would be ..."
"... however thats impossible, so instead we must conclude that ..."]
page "something something something"
page "blah blah blah blah" }
employee{ name: "Michael Scott" title: "Regional Manager"
/[
employee{ name: "Dwight Scrute" title: "Assistant to the Regional Mgr"}
employee{ name: "Jim Halpert"
title: "Head of Sales"
top_customers: [
customer{ first_name: "John" last_name: "Doe" orders_placed: 4500 }
customer{ first_name: "Jane" last_name: "Doe" orders_placed: 2300 }]
/[
employee{ name: "Andy Bernard"
title: "Sales Rep"
top_customers: [
customer{ first_name: "Sam" last_name: "Winchester" orders_placed: 1000}
customer{ first_name: "Dean" last_name: "Winchester" orders_placed: 5 }]}
employee{ name: "Phyllis Lapin"
title:"Sales Rep"
top_customers: [
customer{ first_name: "Hansel" last_name: "Schmidt" orders_placed: 500 }
customer{ first_name: "Gretel" last_name: "Schmidt" orders_placed: 630 }]}
]}
employee{ name: "Pam Beesly" title: "Office Administrator"}]}
Introduction
Notation
Accessors
Commands
Grammar