1: Introduction to PRSE syntax - Asterisk007/prse GitHub Wiki
PRSE is a C-like language. If you have experience with C or C++, you shouldn't have many problems writing a program with PRSE.
Primitives
There are 5 primitive types:
- bool
- int
- double
- char
- string
Arrays
Arrays in PRSE can be created for any primitive type, by adding '[]' after the type specifier.
Variables
Use this syntax to create a variable:
let a: int = 20;
Note that PRSE uses Resource Acquisition Is Initialization (RAII) principles for variable declaration. If you need to create a variable for later use, you still need to assign it some non-null value.
Functions
Syntax:
function Name (param_1: type): return_type {
// Function body
}
param_1 can be any primitive type. You may define as many parameters as you need in the function, or you can omit parameters altogether. A function's return type can be any primitive type. You may alternatively use the keyword func in place of function.
Each parameter defined in a function must have a type attached to it. For instance:
function foo (bar: int, baz: double): string {
// ...
}
is valid syntax, whereas:
function bit (bark, batch): string {
// ...
}
is not valid syntax.