Most people approach Jeebox from a "coder's viewpoint", or a "knowledge_representation" viewpoint. I feel there is a natural and good reason for these two separate viewpoints.
Learn Jeebox Syntax
For this reason I'll explain "Jeebox for code" on this page, and "Jeebox for the real world" on the DRS page. But really, there is only one Jeebox.
Jeebox has two contexts. Argument context, and list context.
This affects parsing. The flow of things is...
Whats a "temporal statement"? Thats my name for commands like "return", "if", "do", "class", etc, that come at the start of a line.
Argument Context Syntax
Argument context, can contain temporal statements. This differs from lists and arrays, which can't.
You can easily construct wierd syntax, like:
but it's best to avoid doing things like that.
The goal of the rules is to allow the kind of syntax that has become natural to modern computer programmers.
This basically parses, as you would expect.
Brackets, and lists, have the same "parse context". The only difference is that a list contains one or more "end-of-line".
Lists are very expressive.
Above is a list with 3 items.
Above is a list with 1 item. Just like in Python, actually.
Above is a list where we have an index "a" and the value is a "thing" named "b".
Above, the index/value pairs don't have to be used on every item, you are free to mix and match as you like.
Despite this "free-form", this syntax can unambiguously express any list, or normal bracket.
Arrays have the same meaning as lists, they just use slightly different syntax.
Jeebox allows indexes to be of any type, or freely mixed even:
Arrays don't need any "special rule" to express a list of 1 item, but lists do.
Jeebox basically does away with precedence, with one exception described in "temporal operators".
The reason for this, is that Jeebox's operators are extensible. You can add new operators as you like.
With no predefined operators, precedence is impossible. So we just abandon it entirely. This actually makes programs more predictable, because now you don't need to find some list of precedence rules, to figure out what comes first, you simply look at the order in which the operators appear.
"Temporal Operators" have a higher precedence than non-temporal operators. They begin with
#and can be any word...
"#until" and "#while" are temporal operators, and come first. This makes the above example, parse as you'd expect. While temporal operators are aimed for "knowledge representation" rather than code, actually you can use temporal operators to describe the code itself.
You can use any name for any operator, you like.
Inbuilt comparison operators.
|= >= <= > < !=|
Inbuilt arithmetic operators.
|∗ - + / >> << ^|
There are 4 unitary operators. They come before their parameter, and "bind" to their parameter more tightly than other operators. You can't add unitary operators.
All arithmetic operators (but not unitary or comparison operators) can be used in "+=" form, just like in C.
Units and numbers
Numbers can be in a few forms:
Units are extensible and quite fun:
Numbers containing units, start with a number and end with a letter.
Units can be utf-8.
Jeebox strings are pretty powerful and flexible... mostly because I was fed up with other languages having bad string support. You can embed Jeebox code in strings.
Letters can be escaped, using "escape codes" or "character references":
Jeebox also lets you write raw bytes... by using "\".
Jeebox accepts Unicode directly... like "(ĴëêƁoⓧ)" so you don't need character references or anything special to store Unicode.
Sometimes find those escape codes a nuisance? Use a backtick string.
More conventional syntax
Declarations and types
Jeebox uses |bars| to declare things.
The type can be omitted. This allows for type inferencing.
Typecasting uses ||, but after the object's name.
Temporal statements are easily the most flexible part of Jeebox!
Temporal statements, are words that start on a line, within "Argument context".
However, there are two exceptions:
example temporal statements:
Temporal statements, use a special rule to make code parse more naturally... Any word after an argument, is a nested temporal statement. Meaning you can do this:
Finally, by using "::", it is possible to put temporal statements, into places that a "thing" (number/object/etc) would normally go. This can be used to get a temporal statement as a thing.
Jeebox syntax is powerfully expressive and fun-to-use. Jeebox was designed so that all it's features work together in harmony.