https://github.com/tjammer/schmu
Mirror of https://codeberg.org/tjammer/schmu
https://github.com/tjammer/schmu
compiler language llvm ocaml programming-language
Last synced: 29 days ago
JSON representation
Mirror of https://codeberg.org/tjammer/schmu
- Host: GitHub
- URL: https://github.com/tjammer/schmu
- Owner: tjammer
- License: eupl-1.2
- Created: 2021-09-27T20:55:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-17T11:37:56.000Z (3 months ago)
- Last Synced: 2025-10-18T14:45:38.667Z (3 months ago)
- Topics: compiler, language, llvm, ocaml, programming-language
- Language: OCaml
- Homepage:
- Size: 5.58 MB
- Stars: 26
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# schmu
Strongly typed, compiled pet programming language.
**Disclaimer** schmu is a passion project which I develop for fun. Please don't use it for anything too serious.
Also, the name will most likely change.
schmu is the language I'd like to program in: A strongly typed, type-inferred compiled language that can be programmed in a functional way (see below).
It prefers stack- over heap allocations, and can easily interface with C code.
Think OCaml, but slightly more control over allocations and data layout.
Here's what it looks like:
Fibonacci example
``` lua
-- variable binding
let number = 35
-- calculate fibonacci number
fun rec fib(n) {
match n {
0 | 1 -> n
_ -> fib(n - 1) + fib(n - 2)
}
}
-- and print it
use fmt
fib(number) |>> println(int)
```
More examples can be found in the skeleton `std` library or the `test` directory.
## Features
+ **Functional**
schmu is a functional language based on a Hindley-Milner type system.
This means all the basic features one might expect from an ML style language are (will be) present, like
+ Parametric polymorphism
+ Higher order functions and automatic closures
+ Algebraic data types and pattern matching
+ Module system
+ Full type inference within a module, but interfaces between modules
+ Focus on recursion
+ **Mutable Value Semantics**
schmu implements [mutable value semantics](https://www.jot.fm/issues/issue_2022_02/article2.pdf) a la [hylo/val](https://www.hylo-lang.org/).
This means references are second-class citizens and cannot be stored in records or returned from functions.
To make this feasible, schmu has move semantics and a simple borrow checkers for downward borrows, such as arguments to functions.
+ **Practical**
schmu aims to be a practical language.
Data types are unboxed to make it straightforward to use C code.
It doesn't try to compete with the fastest languages out there, but should be reasonably fast thanks to LLVM.
It also doesn't try to be a system programming language.
Some low-level access necessary to interface with C code, but that's not what schmu excels at.
## Current focus
+ Tree sitter grammar
+ Test-driving the language