https://github.com/lishy2/adjika
Typed functional language with actors
https://github.com/lishy2/adjika
actor-model compiler llvm
Last synced: 5 months ago
JSON representation
Typed functional language with actors
- Host: GitHub
- URL: https://github.com/lishy2/adjika
- Owner: LIshy2
- Created: 2024-08-28T14:40:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-14T09:58:53.000Z (over 1 year ago)
- Last Synced: 2025-01-15T19:51:25.949Z (over 1 year ago)
- Topics: actor-model, compiler, llvm
- Language: OCaml
- Homepage:
- Size: 163 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Adjika
```
type Either[L, R] = Left (value: L) | Right (value: R)
type List[A] = Cons(head: A, tail: List[A]) | Nil()
fun map(list, f) =
match list {
is Cons(head, tail) => Cons(f(head), map(tail, f))
is Nil() => Nil()
}
actor PingPong {
Waiting();
Playing(counter: int64);
}
type Info = Info(other: MailBox[PingPong])
type Ping = Ping(from: MailBox[PingPong])
handler Info with Waiting = {
mutate Playing(0);
send Ping(me) to message.other;
}
handler Ping with Waiting = {
mutate Playing(0);
send Ping(me) to message.from;
}
handler Ping with Playing = {
mutate Playing(counter + 1);
send Ping(me) to message.from;
}
actor Main {
Starting();
}
handler Starting with Starting = {
val player1 = spawn Waiting();
val player2 = spawn Waiting();
send Info(player2) to player1;
}
```