Remix
Search…
ReMiX

Overview

Remix is a programming language for the Java Virtual Machine.
At the source level, Remix brings new features and freedom. At the VM level, Remix adds safety and security.

Goals

Remix is aimed for small, self-contained serverside progams that are not designed to interact with external resources or other JVM applications.
For beginners, it adds safety and reduces common risks with its strict object-oriented design and encapsulation. For advanced developers, it adds the freedom of organising code in a fluid style and inserting low-level compilation instructions for efficiency.

Simplicity

Remix has only two distinct language elements: words and boxes. Everything can be categorised as one or the other.
Operators are source-level syntax sugar for their built-in functions.
type home <-- words
is building <-- more words
{...} <-- box
Words are distinct (whitespace-separated) character sequences, including all keywords, types, member and variable names. Each word is read and dealt with in sequence by the compiler.
type <-- keyword
home <-- type name
is <-- keyword
building <-- type name
Boxes are matched pairs of curly { and } brackets. These denote ownership or possession of the content inside.
type home { <-- box starts
string address <-- inside box
} <-- box ends
Each box must belong to a word, but not all boxes need to directly follow their word. This allows the programmer to organise their code in a way that they find convenient.
var = true if { <-- belongs to `if`
}
if var = true { <-- belongs to `if`
}

Language Features

Operator Overloading

The behaviour for all of the default operators can be overloaded by user-defined types. This allows developers to alter how a + b should be handled, and create more advanced polymorphic structures.
Logic-based algorithms can be set up to operate almost entirely according to operators.
Symbol
Name
Description
+
Add
Sums the two objects.
-
Sub
Subtracts the second object from the first.
*
Mul
Multiplies the two objects.
/
Div
Divides the first object by the second.
<<
Push
Pushes the second object into the first. This is used for the binary left-shift.
>>
Pull
Pulls the second object from the first. This is used for the binary right-shift.
=
Equals
Compares the two objects and returns their boolean equality.
?
Bool
Evaluates an object as a boolean.
!
Neg
Returns the boolean opposite of the given object.
&
And
Gives the and-result. This is distinct from + to account for binary & operations.
|
Or
Gives the or-result.

Zero Allocation

The RMX schema is not designed to support null pointers. This is partly as a safety feature to prevent null-pointer exceptions that new developers often struggle with, and partly to cater for RMX's value-based object design.
All types support a 'zero instance', which is effectively the object if all of its binary values were zero. Semantically, the value of any zero-instance object.Bool {} should always be 0 but this is not enforced.
A zero-instance can be created using the alloc keyword. Using this keyword guarantees a new instance of the object is created.
integer num { alloc integer }
if integer = 0 { <-- always true
}
Unlike the new keyword, alloc never accepts any parameters and has no box attached.
The alloc keyword does not call a constructor. This allows constructor-less objects to be created.
It is generally not advised to allocate objects directly when there is a new constructor available, since it may produce an unsupported result.
Zero-allocation is used in several places under the hood, such as when a variable is declared with no value integer num {} or a constructor hits an uncaught error and cannot produce a value.

Implementation

All objects and operations are handled as pointers rather than via primitive values. This is done to add safety and allow advanced overloading or creation of new raw-data types (e.g. numbers) at the small cost of speed in some cases.
After the introduction of primitive classes as a VM feature, all types will be primitive unless the advanced pointer feature is used.
Last modified 7mo ago
Copy link
On this page
Overview
Goals
Simplicity
Language Features
Implementation