Less confusing branches #1

Open
able wants to merge 10 commits from something into master
9 changed files with 39 additions and 6 deletions
Showing only changes of commit 511be2db4e - Show all commits

View file

@ -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);
}

View file

@ -1 +1,2 @@
// there must only be one main and it ***MUST*** exist
func main(){}

View file

@ -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
}
}

View file

@ -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(){}

View file

@ -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 {}
}

View file

@ -5,5 +5,6 @@ func main() {
match 2 {
1 -> { print("One") }
2 -> { print("Two") }
// If there is not a matching case continue
}
}

View 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);
}

View file

@ -1,4 +1,5 @@
func random_u64(){
// TODO: randomness
return 3;
var value = 0;
return value;
}

View file

@ -1,5 +1,7 @@
var log = include "log";
// print accepts all types in value
func print(value) {
// TODO: define an api for output
}