-
Notifications
You must be signed in to change notification settings - Fork 10
Home
The compiler for Expression 3 is a huge work in progress and there for the syntax of this language is likly to change over the course of its development.
Expression 3 uses a language based on expression advanced 2 but is closer to c#, it is often described as a lua and c# mash up.
Expression 3 support 2 styles of comments. Single line
//Example of a single line comment
Multi line
/* Example
of a multi line
comment */
In expression 3 a block of code is wrapped in curly brackets.
{
// Example
}
These brackets can be omitted causing only the first line to be used as the block.
An if statement is a conditional statement that will execute a block of code only under certain conditions.
if (condition) block
elseif (condition) block
else block`
These statements will only execute a block of code based on if the code is running server side or client side.
server block
client block
All assignment statements in expression 3 can be used to assign one or more values at once.#
When defining a variable it is important to note that it is nested to its current block.
class variable[, variable]* = expression[, expression]*;
number a = 7;
string first, last = "John", "Doe";
Same as a definition statement except defines a global variable, these variables are not nested to there current block.
global class variable[, variable]* = expression[, expression]*;
global number a = 7;
global string first, last = "John", "Doe";
Assignments are used to assign a value to an existing variable.
variable[, variable]* = expression[, expression]*;
a = 7;
first, last = "John", "Doe";
Arithmetic assignments are used to perform an arithmetic operation on a variable and then assign the result of that operation to the variable.
variable[, variable]* += expression[, expression]*;
exampleVar, anotherVar += 100, 200;
variable[, variable]* -= expression[, expression]*;
exampleVar, anotherVar -= 100, 200;
variable[, variable]* \= expression[, expression]*;
exampleVar, anotherVar \= 100, 200;
variable[, variable]* *= expression[, expression]*;
exampleVar, anotherVar *= 100, 200;
Expression 3 supports user defined functions.
function type variable([type parameter,]*) block
function int example(int a, int b) {
return a + b;
}
Delegates are function templates and are used by the compiler to retain information about a functions parameters as well as its return values. This will be covered in depth in a later section.
function type variable([type,]*) {
return number
}
function string example(string, string) {
return 1
}
The number that appears after return is the amount of values returned of type.
Expression ? Expression : Expression
Expression || Expression
Expression && Expression
Expression ^^ Expression
Expression | Expression
Expression & Expression