Add a directory with documentation files.

This commit is contained in:
Username404 2021-07-31 21:04:15 +02:00
parent 4512909b23
commit 677868a959
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 46 additions and 3 deletions

View File

@ -6,13 +6,12 @@
Aka Yer Bacon,
- #### A language that transpiles into lua, javascript or python code.
Here's how a "hello world" lambda will look like (`#=>` can be used as a shorthand for `#= ->`)
```
main #=> {
println "Hello, World!"
}
```
### Planned features:
- Type inference
@ -20,7 +19,7 @@ main #=> {
- Compilation to jvm bytecode?
## Getting Started
Variables assigned using #= can't be changed (they are "final"), while the ones affected using the normal operator (=) can.
#### See the <a href="/Username404-59/Yerbacon/src/branch/stable/docs/gettingstarted.md">documentation</a>
## Build requirements

44
docs/gettingstarted.md Normal file
View File

@ -0,0 +1,44 @@
## 1 - Variables
Variables defined using #= can't be changed (they are "final"), while the ones affected using the normal operator (=) can.
```
helloworld #= "Hello World"
```
## 2 - (Anonymous) Functions
You can make an anonymous functions using the following syntax:
```
getHelloWorld: ~String => {
return "Hello World!"
}
```
<sub>`~String` can be omitted, see [#3](#3---types).</sub>
Note that you can make `getHelloWorld` final by replacing `=>` with `#=>`.
To define a **named** (and mandatorily final) function, replace `=>` with `>>` and put the (optional) return type before the function's name:
```
String getHelloWorld >> {
return "Hello, World!"
}
```
### 2.1 - Main
Main can be a variable named `main` that contains an anonymous function, a function named `main` or a function that has the `as_main` attribute:
```
main #=> {}
main >> {}
as_main helloWorld >> {}
```
## 3 - Types
Types are *inferred*, which means that specifying types of variables or returned values is optional.
Every variable has a static type by default; it is possible to make a **non-final** variable dynamic by adding the `dyn`/`dynamic` attribute:
```
dyn helloWorld = 0
helloWorld = "Hello World!"
```
The attributes mentioned above can also be used as a return type for functions/anonymous functions:
```
helloWorld: ~dynamic => {}
dyn helloWorld >> {}
```