commit ff01213da420b9d36d8495f9b556f089806a9d0d Author: Sasha Koshka Date: Wed Aug 3 11:09:00 2022 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e12f215 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +/arfc/arfc + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work diff --git a/examples/basic/main.arf b/examples/basic/main.arf new file mode 100644 index 0000000..2b0caa7 --- /dev/null +++ b/examples/basic/main.arf @@ -0,0 +1,3 @@ +:arf + +func rr main diff --git a/examples/full/main.arf b/examples/full/main.arf new file mode 100644 index 0000000..e64decb --- /dev/null +++ b/examples/full/main.arf @@ -0,0 +1,41 @@ +:arf +author "Sasha Koshka" +license "GPLv3" +require "io" +--- + +# this is a global variable +data wn 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" + +# this is a function +func rr main + > argc:Int + > argv:{String} + < status:Int 0 + --- + let greeter:Greeter:mut + greeter.setText helloText + greeter.greet + +# this is a member function +func rr greet + @ greeter:{Greeter} + --- + io.println greeter.text + +# this is mutator member function +func rr setText + @ greeter:{Greeter} + > text:String + --- + greeter.text.set text + diff --git a/examples/tokens/general.arf b/examples/tokens/general.arf new file mode 100644 index 0000000..4523a2a --- /dev/null +++ b/examples/tokens/general.arf @@ -0,0 +1,11 @@ +:arf +require io +--- + +func rr main + > argc:Int + > argv:{String} + < status:Int + --- + io.println [io.readln] + = status 0 diff --git a/examples/tokens/literals.arf b/examples/tokens/literals.arf new file mode 100644 index 0000000..b1b56f9 --- /dev/null +++ b/examples/tokens/literals.arf @@ -0,0 +1,13 @@ +: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 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2da2f4b --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/sashakoshka/arf + +go 1.18