Skip to content

The Language

Amukh1 edited this page May 3, 2023 · 5 revisions

In-line Assembly

asm("<assembly here>");
<assembly here>

Function definition

A function named name, with parameters and , and as a body:

func name(<p1>, <p2>) {
   <body>
};

General scope

Rpp programs start in the main function. The main function takes two parameters: argc, and argv. argc is the number of command line arguments, and argv is a vector containing them.

func main(argc, argv) {
    <RPP code>
};

Function call

Call a function named name, with parameters and :

name(<p1>, <p2>);

Global Variables

Global variable named name, with value :

var name = <value>;

⚠️ Global values are "global" because any function in the file scope can access them to make a variable truly global you must export it

Exports and Imports

Exports and Imports work on symbols (functions, variables, etc..)

import println
println("hi",2);

Imports println function, if and only if the core package is linked with the rpp output.

exports
func main(...) {...};

Exports main so it can be accessed by other files, similar to println in the example above.

Pointers and References

To make a pointer (ap) to another variable (a):

var& ap = a;

To deference a pointer (ap) pointing to another variable (a), in (b):

var* b = ap;
// b == a