📝 updated readme.

main
bog 2024-03-07 15:49:37 +01:00
parent da58cc987b
commit 5863ff5212
1 changed files with 154 additions and 2 deletions

156
README.md
View File

@ -1,3 +1,155 @@
# bog # Hello ! Welcome to my gitea account :)
HelloWorld! I have a **real** obsession for programming language design and development. I did a lot of prototypes, and most of them are just crappy full of bugs programs. **But**, some projects are ok as prototypes.
Here you will find short descriptions of some languages I am not too ashamed to show. Some of them look like BASIC, and others like LISP. All of them was made with love, and dropped with the hope to make something better.
Enjoy.
---
[wuz](https://git.shellbox.fr/bog/wuz) is a programming language made in C with flex and bison. Its syntax looks like good old BASIC but having a more functional approach.
```
# a simple factorial
fun f (n as int) as int
if n == 0
return 1
end
return n * f(n - 1)
end
assert 120 == f 5
```
```
# a high order function
fun h (n as int, m as fun<int:int>) as int
return (m (m n))
end
```
---
[roza](https://git.shellbox.fr/bog/roza) is pretty much a clone of wuz with a syntax slightly different.
```
# functions are first class citizens
let a = fun (x as int, y as int) -> int
return x + y
end
# function calls using curly brackets
assert 12 == {a 9 3}
assert 6 == {a {a 1 2} 3}
```
---
[grino](https://git.shellbox.fr/bog/grino) adopt a more functional lisp like syntax. Keywords are as short as possible: the function ``$`` is used to declare variables and the function ``->`` returns a lambda.
```
;; declare lambda
($ a (-> (x) (* x 2)))
(assert= 14 (a 7))
;; recursive factorial on lambda
(assert= 720 ((-> (x)
(if (eq? x 0)
1
(* x (self (- x 1))))) 6))
```
Grino supports [closures](https://en.wikipedia.org/wiki/Closure_(computer_programming)), allowing the definition of statefull functions.
```
;; Let's count !
($ (i init)
($ counter (- init 1))
(-> ()
(set! counter (+ counter 1))
counter))
($ j (i 0))
(assert= 0 (j))
(assert= 1 (j))
(assert= 2 (j))
(assert= 3 (j))
(assert= 4 (j))
```
---
[fakir](https://git.shellbox.fr/bog/fakir) has pratically the same syntax and semantic than grino. Fakir adds module importation features using the function ``@``.
```
($ a (@ './mod2'))
(assert= 42 a::var)
(assert= 6 (a::fun 3))
```
---
[snake](https://git.shellbox.fr/bog/snake) is a language agnostic build system.
```
x y z -> (*.py) {
$IN
}
```
```
$Y = (x.c y.c z.d w t.h)
d -> a {
$Y[c.=.h]
}
```
---
[duck2d](https://git.shellbox.fr/bog/duck2d) is a little game framework scheme (a dialect of LISP) tool. It uses C++, OpenGL for rendering the game and guile for the scheme interface. It features an Entity Component System ([ECS](https://en.wikipedia.org/wiki/Entity_component_system)) to manage game entities.
---
[muzgen](https://git.shellbox.fr/bog/muzgen) is a programming language for sound design tasks. It allows to manipulate and combinate oscillators in order to craft interesting sounds.
```
# play a sine at 440Hz.
[sine 440]
# combine by adding two signals
[add [sine 220] [sine 220]]
# using one sine to control another
[sine [mul 440 [sine 1]]]
```
---
[gux](https://git.shellbox.fr/bog/gux/src/branch/main/tests/fun.gux) is a statically and strongly typed language with a more modern syntax.
```
# variable declaration
var x : int = 4;
var y := 3.2;
# factorial function
fac := fun (n: int) -> int {
if n == 0 { return 1; }
return n * this(n - 1);
};
# function overloading
fun first(n: int) -> int {
return 27;
}
fun first(n: float) -> int {
return 79;
}
assert first(4) == 27;
assert first(7.3) == 79;
```