sussy
This commit is contained in:
parent
850696a7ab
commit
0c6878b48a
|
@ -2,6 +2,9 @@ var std = include "std";
|
|||
var print = std.print;
|
||||
|
||||
func main(){
|
||||
var arr = [123, 456, 789];
|
||||
print(arr[1]);
|
||||
// Arrays do exist only tuples packed into a single var
|
||||
// zero indexed
|
||||
var arr = (123, 456, 789);
|
||||
// Print 456
|
||||
print(arr.1);
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
// there must only be one main and it ***MUST*** exist
|
||||
func main(){}
|
|
@ -1,10 +1,18 @@
|
|||
func main() {
|
||||
var abc = 0;
|
||||
// an asm block may use variables outside of the asm scope
|
||||
asm {
|
||||
jmp r0, start
|
||||
start:
|
||||
jmp r0, start
|
||||
li r1, abc
|
||||
}
|
||||
// This is not really a requirement
|
||||
opcode {
|
||||
01
|
||||
}
|
||||
|
||||
// Exit
|
||||
var exit_status = 0;
|
||||
asm {
|
||||
li r255, exit_status
|
||||
tx
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
// The only thing included here is the ability to pull in other functions
|
||||
// This is not a * include
|
||||
var std = include "std";
|
||||
|
||||
func main(){}
|
|
@ -1,11 +1,15 @@
|
|||
func main(){
|
||||
var i = 0;
|
||||
// The only loop is `loop` and it does not do any form of count up and break
|
||||
loop {
|
||||
match i {
|
||||
// break will break out of `one` loop
|
||||
10 -> break;
|
||||
}
|
||||
// Increment by one
|
||||
i = i + 1;
|
||||
}
|
||||
// This is functionally identical to a HCF
|
||||
loop {}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,5 +5,6 @@ func main() {
|
|||
match 2 {
|
||||
1 -> { print("One") }
|
||||
2 -> { print("Two") }
|
||||
// If there is not a matching case continue
|
||||
}
|
||||
}
|
10
assets/examples/string.rhea
Normal file
10
assets/examples/string.rhea
Normal file
|
@ -0,0 +1,10 @@
|
|||
// This string ***MUST*** never be edited
|
||||
const b_string = "XYZ";
|
||||
|
||||
func main() {
|
||||
var a_string = "ABC";
|
||||
// strings may be added together
|
||||
var fmt = a_string + " length " + a_string.len;
|
||||
// print may only take one argument
|
||||
print(fmt);
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
func random_u64(){
|
||||
// TODO: randomness
|
||||
return 3;
|
||||
var value = 0;
|
||||
return value;
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
var log = include "log";
|
||||
|
||||
|
||||
// print accepts all types in value
|
||||
func print(value) {
|
||||
// TODO: define an api for output
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue