init
This commit is contained in:
commit
34e45e702f
16 changed files with 1109 additions and 0 deletions
42
README.md
Normal file
42
README.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
## Basic hello world
|
||||
|
||||
```c
|
||||
open std::io;
|
||||
|
||||
// const { io } = import!("std");
|
||||
pub main := fn() -> () {
|
||||
io.println("Hello, world");
|
||||
io.Writer
|
||||
iterator.map(color::Color::to_bytes)
|
||||
};
|
||||
```
|
||||
|
||||
## Structured data
|
||||
|
||||
```c
|
||||
Color ::= Color { red: u8, green: u8, blue: u8 };
|
||||
```
|
||||
|
||||
## Union types
|
||||
|
||||
```c
|
||||
Result<T, E> ::= Ok (T) | Err (E);
|
||||
|
||||
Option<T> ::= Some (T) | None;
|
||||
|
||||
MaybeColor ::= SomeColor { red: u8, green: u8, blue: u8 } | None;
|
||||
```
|
||||
|
||||
# Symbol Semantics
|
||||
|
||||
- `=` => Equal by assignment (or reassignment)
|
||||
- `:=` => Equal by definition
|
||||
- `::=` => Equal in structure or type
|
||||
- `//` => in-line comment
|
||||
- `///` => in-line doc comment
|
||||
- `//!` => in-line module doc comment
|
||||
- `|` => type union
|
||||
|
||||
## Classes
|
||||
|
||||
Same thing as a Haskell typeclass or Rust trait.
|
||||
Loading…
Add table
Add a link
Reference in a new issue