Cleaned up example code and made it up-to-date

This commit is contained in:
Sasha Koshka 2022-08-20 15:54:10 -04:00
parent 61819311e9
commit ca80a5968d
4 changed files with 26 additions and 50 deletions

View File

@ -1,3 +1,9 @@
:arf
require "io"
---
func rr main
func ro main
> arguments:{String}
< status:Int 0
---
io.println "hello world"

View File

@ -5,37 +5,31 @@ require "io"
---
# this is a global variable
data wn helloText:String "Hello, world!"
data pv helloText:String "Hello, world!"
# this is a struct definition
type rr Greeter:Obj
# "Hi." is a string constant. all Greeters will be initialized with a
# pointer to it. I don't know really it depends on what I decide that
# a String type even is.
wr text:String "Hi."
"sdfdsf" "ahh"
"asdf"
objt ro Greeter:Obj
wr text:String "Hi."
# this is a function
func rr main
> argc:Int
> argv:{String}
< status:Int 0
---
let greeter:Greeter:mut
greeter.setText helloText
greeter.greet
func ro main
> arguments:{String}
< status:Int 0
---
set greeter:Greeter:mut
greeter.setText helloText
greeter.greet
# this is a member function
func rr greet
@ greeter:{Greeter}
---
io.println greeter.text
func ro greet
@ greeter:{Greeter}
---
io.println greeter.text
# this is mutator member function
func rr setText
@ greeter:{Greeter}
> text:String
---
greeter.text.set text
func ro setText
@ greeter:{Greeter}
> text:String
---
greeter.text.set text

View File

@ -1,11 +0,0 @@
:arf
require io
---
func rr main
> argc:Int
> argv:{String}
< status:Int
---
io.println [io.readln]
= status 0

View File

@ -1,13 +0,0 @@
:arf
---
data:{Int 6}
-39480 398 29 0x3AFe3 0b10001010110 0o666
func rr literals
---
= stringLiteral:String "skadjlsakdj"
= intArrayLiteral:{Int 3} 2398
-2938 324
= runeLiteral:Rune 'a'
= floatArrayLiteral:{F64 5} 3248.23 0.324 -94.29