Update documentation and readme

This commit is contained in:
Sofia 2025-07-28 01:06:38 +03:00
parent 195d3d3af8
commit 4844cebd56
3 changed files with 36 additions and 2 deletions

View File

@ -9,8 +9,8 @@ contains the relevant abstraction to produce a more Rust'y API from that.
Much of the syntax in Reid is directly inspired by rust, but mostly it is driven
by simplicity.
Specifications and documentation for the language can be found
[here](./documentation/).
Specifications and a bunch of [documentation for the language can be found
here](./documentation/).
Reid is currently able to (non-exhaustively):
- Do basic algebra binary and unary-operations (e.g. Add, Sub, Div, Mult, And,

View File

@ -18,6 +18,12 @@ A collection of documentation and examples to get you going can be found at [the
Book of Reid](./book.md). It is recommended you read through the chapter about
Syntax first though to familiarize yourself with the basic concepts of Reid.
## Intrinsics
Reid also has intrinsic functions that are good to know about. These are more
in-depth, but when you're feeling up to it, you can read about them
[here](./intrinsics.md).
## Syntax and general information
Syntax for Reid is very much inspired by rust, and examples of the language can

View File

@ -0,0 +1,28 @@
## Intrinsics
Intrinsics are functions that are defined within the language compiler but not
in standard library, thus they do not require importing in order to use (and
trying to re-define these will end up causing issues). Intrinsics include all
pre-existing binary-operators, but also some regular functions and associated
functions (that every type has by-default). This document lists them all (except
for the binary operators, because there are hundreds of those).
### Associated Intrinsics
#### `<T>::sizeof() -> u64`
Simply returns the size of type `T` in bits.
```rust
i32::sizeof(); // Returns 32
```
#### `<T>::alloca(size: u64) -> *T`
Allocates `T::sizeof() * size` bits and returns a pointer to `T`.
**Note:** This does not seem to work correctly currently.
```rust
i32::alloca(30); // Returns *i32
```