Start work on lists

This commit is contained in:
2025-08-10 13:31:28 +10:00
parent f43f79b869
commit 2e388c6e68
4 changed files with 231 additions and 8 deletions

View File

@@ -32,6 +32,18 @@ Reference a line (a line reference) with a percent symbol before a line number:
jump %10
```
(WORK IN PROGRESS) Alternatively, set a label and jump to that (setting labels will be discussed below):
```
jump %myLabel
```
Reference a list (a list reference) with an asterisk:
```
setlist *myList $value1 $value2 # and so on
```
### Keywords
Note: &var can be replaced with any direct reference. $value can be replaced with a literal value or a value reference. %1 can be replaced with a line reference.
@@ -54,7 +66,7 @@ Usage: `jump %1`
Ends the program. Requires an integer for a status code.
Usage: `end $value`
Usage: `end $intvalue`
#### stdin
@@ -80,6 +92,30 @@ Allows you to set a variable to a value.
Usage: `set &var $value`
#### setlist
Allows you to initialize a list.
Usage: `setlist *list $value1 $value2 $value3...`
#### setlistat (WORK IN PROGRESS)
Sets a list item at an index. The item at the index must already exist. Lists are index 0.
Usage: `setlistat *list $intvalue $value`
#### getlistat
Gets a list item at an index, and puts it in the variable provided. The item at the index must already exist. Lists are index 0.
Usage: `getlistat *list $intvalue &var`
#### getlistsize
Gets the size of a list and puts it in the variable provided.
Usage: `getlistsize *list &var`
#### add
Adds two numbers. Numbers mean an integer or a double. Outputs to a direct reference.
@@ -126,4 +162,4 @@ Usage: `greater $value $value &var`
Checks if the left value is lesser than the right value. Outputs a boolean to a direct reference.
Usage: `lesser $value $value &var`
Usage: `lesser $value $value &var`