Jeebox Language Introduction

Jeebox is an extensible language for describing code, concepts and stories.

Here are some examples:

Code print "hello world" arr[n] = obj.func(var)

Concepts dogs are animals all~matter has gravity

Stories Fred ran #until Fred was tired how:can (~someone fall so~far) #without %realising ~it

Jeebox has some really cool properties...




Extensibility



The most important thing, is that Jeebox is "extensible".

There are no keywords necessary to parse Jeebox. Not "Return" or "if" or "loop" or anything. And yet, it will sensibly parse such constructs.

// "select" and "function" are not keywords, but are correctly parsed. function example ( |int| a b c ) { } select (A, B, C) from T where (D > 0) // "if", "contains" and "mod" are not keywords, but are correctly parsed. if (x contains y) { x = a mod b }




Comments and lines



Comments are // and /**/, just like C++ comments.

Line endings are CR, LF, and comma! Commas and lines are interchangable. Even function calls in Jeebox can be expressed using lines to separate items.

x = MyFunc(AVeryLongName, AnotherLongName, TheseNamesGetTooLongForOneLine) x = MyFunc( AVeryLongName AnotherLongName TheseNamesGetTooLongForOneLine )

Actually, even comments are considered end of line. This is nice, because it makes it impossible to make unreadable comments, like in C++ where you can put a comment in the middle of a line.

if /*hello*/ (test) { func1/*bye*/(b); } // C++ comments
/*hello*/ if (test) { func1(b) } /*bye*/ // Jeebox comments

Want multiple statements on a single line? Sure, commas are lines, remember?

x = y + 1, if x > z {return}



Strings and lists only!



An interesting, and exciting thing, is that Jeebox's abstract syntax tree (AST) is defined purely in terms of strings, and lists. Nothing else. This makes Jeebox easy to understand, process, and generate.

In Jeebox, an AST for "a=(b+c)" would look like:

("rel", ("thg", "a"), ("opp", "="), ("bra", ("rel", ("thg", "b"), ("opp", "+"), ("thg", "c"))))



Homo-iconicity



Jeebox is homo-iconic. Basically, Jeebox can describe itself, in terms of itself.

Heres an example of homoiconicity:

("thg", "b") // This Jeebox code, when parsed becomes ("lst", ("str", "thg"), ("str", "b")) // this Jeebox list AST




XML!



Another important thing, is that Jeebox's AST, can be expressed in XML, and read back from XML. The advantage of this, is to make Jeebox easily parsable by outside tools. Jeebox would convert the code to XML for you, the tools don't even have to parse Jeebox, just XML.

if (A) {B=A+1} // This Jeebox code // it's AST can be expressed with this XML: <tmp>if<bra><thg>A</thg></bra><arg><rel><thg>B</thg><opp>=</opp><rel><thg>A</thg><opp>+</opp><num>1</num></rel></rel></arg></tmp>




Cleanliness



• No semi-colons used to end lines like in C++.
• Extensibility relies on code structure, not inbuilt keywords. This enforces more consistent code.
• Comments end lines, stopping comment misuse.
• Define your own units (10USD, 808rgb, -3i, 0FEFF_x, 010101b).
• Strings understand embedded code (str = "Time: {test.duration}s").
• General focus on making Jeebox clean. So many small things were given attention that it needs it's own page to list them all.




In summary



Jeebox is an expressive, sensible and powerful new language. Jeebox isn't just modern, Jeebox defines a new era.

The design is open, and easy to develop tools for.

By having zero inbuilt keywords, Jeebox becomes your own playground.




Next: Why not learn more about Jeebox ?