Cube is a dynamically typed, class based object oriented scripting language with a syntax similar to Ruby.
Only simple declarations and expressions are being parsed at the moment. There is a built in REPL
which can be accessed by running the
cube executable without a script file name.
The typical operator precedence rules apply. The currently working precedence levels are (from highest to lowest):
- Unary Not (!), Negation (-)
- Exponentiation (^)
- Multiplication (*), Division (/), Modulo (%)
- Addition (+), Subtraction (-)
- Comparison (<, <=, >, >=)
- Equality (==), Inequality (!=)
The precedence levels can be overridden with parentheses.
> (2 + 20) * 100 -> 2200 > 2 + 20 * 100 -> 2002
Global variables can de declared and used in expressions.
> var some; > some = 10; > var more = 100; > print some + more; -> 110
Simple blocks and local variables can now be used. (The REPL can not currently handle multiple line constructs, so the entire
do ... end loop must be on a single line.)
> var i = 10; > do var i = 100; print i; end -> 100 > print i; -> 10
Use Ctrl-C or enter 'exit' to leave the REPL.
To be implemented.
To be implemented.
Building Cube has only been tested on macOS Sierra, High Sierra and Ubuntu 18.04. It is very early in development.
The GNU Readline library is used to make the REPL a bit more useful.
On macOS use Homebrew to install Readline.
brew install readline
On Ubuntu you can install Readline with the following command.
sudo apt-get install libreadline-dev
Cube can be built in either debug or release mode. Running
make alone will generate
the release build. Running
make debug will generate the debug build.
The resulting builds can be found in the
There is also a
make clean target to clear out all of the build files.
There is no install
make target yet, all work is being done in development. I will fill
this in where there are more installation details.
- David J Lains - Initial Work - dlains