push brainstorm markdown
This commit is contained in:
parent
73a6f0a6bd
commit
a9e2e3d462
39
docs/overview.md
Normal file
39
docs/overview.md
Normal 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
22
lib/omniflan.ml
Normal 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
|
Loading…
x
Reference in New Issue
Block a user