diff options
author | Matthew Sotoudeh <matthewsot@outlook.com> | 2017-07-30 12:58:04 -0700 |
---|---|---|
committer | Matthew Sotoudeh <matthewsot@outlook.com> | 2017-07-30 12:58:04 -0700 |
commit | d22e94589a8e744428763626cc8290418ec999b0 (patch) | |
tree | ac62397cbfed0e0654b04ac5b9f870a7085e8014 | |
parent | 4c3c7de3e8b2375dd90a0a4b9922b0e4a9cf0c1f (diff) |
updated README
-rw-r--r-- | README.md | 92 | ||||
-rw-r--r-- | editor/.editor.html.swo | bin | 12288 -> 0 bytes |
2 files changed, 46 insertions, 46 deletions
@@ -22,88 +22,88 @@ Writes "Hello, World!" followed by the length of "Hello, World!" ``` write "Hello, World!" //Write "Hello, World!" to the console -str-len "Hello, World!" -> $len //Store the length of "Hello, World!" as $len -num-to-str $len -> $len //Convert $len to a string before writing it -write $len //Write $len to the console +str-len "Hello, World!" -> len //Store the length of "Hello, World!" as len +num-to-str len -> len //Convert len to a string before writing it +write len //Write len to the console ``` # Functions Consider a simple ``index-of`` function: ``` -@index-of $arr $search: - copy 0 -> $i - len $arr -> $arr_len +@index-of arr search: + copy 0 -> i + len arr -> arr_len #loop - array-el $arr $i -> $currEl - not-eq $currEl $search -> $continue - add $i 1 -> $i - lt $i $arr_len -> $still_legal + array-el arr i -> currEl + not-eq currEl search -> continue + add i 1 -> i + lt i arr_len -> still_legal - and $still_legal $continue -> $continue - jump-if $continue #loop + and still_legal continue -> continue + jump-if continue #loop - add $i -1 -> $i + add i -1 -> i - return $i + return i @end -index-of "Hi!" "i" -> $index -write $index //2 +index-of "Hi!" "i" -> index +write index //2 ``` # Built-in functions reference: ``` //Value functions -copy $a -len $a +copy a +len a //IO functions -write $str -prompt $prompt +write str +prompt prompt //Numerical functions -add $a $b -subtract $a $b -multiply $a $b -divide $a $b -rand-num $low $high +add a b +subtract a b +multiply a b +divide a b +rand-num low high //String functions -str-combine $str1 $str2 //Alias for add (in Javascript) -str-len $str //Alias for len (in Javascript) +str-combine str1 str2 //Alias for add (in Javascript) +str-len str //Alias for len (in Javascript) //Array functions array-new -array-len $arr //Alias for len (in Javascript) -array-el $arr $index -array-set-el $arr $index $item -array-push $arr $item -array-pop $arr +array-len arr //Alias for len (in Javascript) +array-el arr index +array-set-el arr index item +array-push arr item +array-pop arr //Comparison functions -eq $a $b -not-eq $a $b -not $a -lt $a $b -lt-eq $a $b -gt $a $b -gt-eq $a $b -or $a $b -and $a $b +eq a b +not-eq a b +not a +lt a b +lt-eq a b +gt a b +gt-eq a b +or a b +and a b //Conversion functions -num-to-str $num -str-to-num $str +num-to-str num +str-to-num str //Control functions jump-bwd #label -jump-bwd-if $condition #label +jump-bwd-if condition #label jump-fwd #label -jump-fwd-if $condition #label +jump-fwd-if condition #label jump #label -jump-if $condition #label +jump-if condition #label ``` diff --git a/editor/.editor.html.swo b/editor/.editor.html.swo Binary files differdeleted file mode 100644 index 44c9a44..0000000 --- a/editor/.editor.html.swo +++ /dev/null |