push brainstorm markdown

This commit is contained in:
omniscient 2024-07-06 23:23:54 +10:00
parent 73a6f0a6bd
commit a9e2e3d462
3 changed files with 61 additions and 0 deletions

39
docs/overview.md Normal file
View File

@ -0,0 +1,39 @@
# Overview
Concepts:
- Primitives
- u8, i32, f32, bool, char
- lists, slice, fixed-length array builtin, matrices
- Control flow
- for, while, break
- Structs & tuples
- Let bindings
- `Ptr a`
- Pattern matching
- ADTs
- Mutability
- const by default?
- Functions
- Array syntax
- ranges `arr[1..]`, `arr[..3]`
- index `arr[4]`
- Stdlib
- string
- vec/dynarray
- hashtable
- option/result
C-like with Roc syntax.
Start with interpreter. Output C later down the track
```rust
let slice = &[u32];
[1,23,45,4,1]
let new_vec: Vec<i32> = iterator.iter_mut()
-> map(|x| *x = 100 ) -- allocs?
-> filter -- allocs?
-> filter -- allocs?
.collect()
```

22
lib/omniflan.ml Normal file
View File

@ -0,0 +1,22 @@
type binary_opt =
| Add
| Subtract
| Multiply
| Divide
type expr =
| Let of { name: string; bindee: expr }
| Binary of { lhs: expr; rhs: expr; operator: binary_opt }
| IfElse of { condition: expr }
type builtin_type =
| I32
| F32
| Bool
| Char
module Examples = struct
let let_bind_int = "let x = 10"
let let_bind_str = "let s = \"hello\" "
end