91 lines
1.2 KiB
Markdown
91 lines
1.2 KiB
Markdown
# Funk
|
|
|
|
Funk is an interpreted programming language.
|
|
|
|
## Getting started
|
|
|
|
First of all, you'll need to build the Funk interpreter:
|
|
|
|
```bash
|
|
mkdir build
|
|
cd build
|
|
cmake ..
|
|
make
|
|
./funk
|
|
```
|
|
|
|
Now you can get coding!
|
|
|
|
## Syntax
|
|
|
|
Funk requires a main function for your code to begin execution in. Define it like this:
|
|
|
|
```
|
|
main func {
|
|
println("Hello, World!")
|
|
}
|
|
```
|
|
|
|
You can define other functions and call them if you wish.
|
|
|
|
```
|
|
dingus func {
|
|
println("You got dingused")
|
|
}
|
|
|
|
main func {
|
|
dingus()
|
|
}
|
|
```
|
|
|
|
Use `if` and `while` for control flow.
|
|
|
|
Note: Equality operators like `==`, `!=`, etc, etc aren't supported yet. This is a new project, after all.
|
|
|
|
```
|
|
main func {
|
|
if (true) {
|
|
println("It's true!")
|
|
}
|
|
}
|
|
```
|
|
|
|
```
|
|
main func {
|
|
while (true) {
|
|
println("To infinity and beyond!")
|
|
}
|
|
}
|
|
```
|
|
|
|
Set variables with `=`.
|
|
|
|
```
|
|
main func {
|
|
x = 5
|
|
}
|
|
```
|
|
|
|
And access them by, you know, accessing them.
|
|
|
|
```
|
|
main func {
|
|
x = 5
|
|
println(x)
|
|
}
|
|
```
|
|
|
|
Note: If you'd like you can do this:
|
|
|
|
```
|
|
main = func {
|
|
println("Ooh functional looking programming")
|
|
}
|
|
```
|
|
|
|
<sub>functions are indeed objects >:)</sub>
|
|
|
|
## License
|
|
|
|
Funk is licensed to you under the GNU GPL v3.0. Contributions are welcome!
|