ssf
is a structurally-typed strict functional core language supposed to be used as a target language for high-level strict functional programming languages.
This repository consists of two crates of ssf
and ssf-llvm
. The former is to construct intermediate representation (IR) of ssf
going through type check and other validation and the latter is to compile it into LLVM IR bitcode.
In your Cargo.toml
,
ssf = { git = "https://github.com/raviqqe/ssf", branch = "master" }
ssf-llvm = { git = "https://github.com/raviqqe/ssf", branch = "master" }
- Inference of closure environment types
- Partial application
- Bit cast
- Lazy evaluation
- Type inference
- The IR needs to be fully-typed already.
- Generics
- Garbage collection
- Bring your own GC.
- Functions
- Algebraic data types
- Constructors are boxed or unboxed explicitly.
- Primitives
- 8-bit integer
- 32-bit integer
- 64-bit integer
- 32-bit floating point number
- 64-bit floating point number
- Pointer
- Tags are pointer-sized integers.
- Constructor payloads boxed or unboxed contain their elements.
- Empty data
(payload size) |
---|
payload |
(pointer size) |
---|
tag |
(pointer size) | (max payload size) |
---|---|
tag | payload |
let algebraic_type = ssf::types::Algebraic::new(vec![ssf::types::Constructor::boxed(vec![
ssf::types::Primitive::Float64.into(),
])]);
let bitcode = ssf_llvm::compile(
&ssf::ir::Module::new(
vec![],
vec![ssf::ir::FunctionDefinition::new(
"f",
vec![ssf::ir::Argument::new("x", ssf::types::Primitive::Float64)],
ssf::ir::ConstructorApplication::new(
ssf::ir::Constructor::boxed(algebraic_type.clone(), 0),
vec![ssf::ir::Variable("x").into()],
),
algebraic_type,
)
.into()],
)
.unwrap(),
&CompileConfiguration::new(None, None),
)?;