Add docs to lib.rs
This commit is contained in:
parent
a907fec967
commit
f7fa69fbe2
@ -1,3 +1,35 @@
|
|||||||
|
//! Reid is a toy-language compiler I'm working on to learn LLVM (and compiler
|
||||||
|
//! development).
|
||||||
|
//!
|
||||||
|
//! Reid only uses [llvm-sys](https://gitlab.com/taricorp/llvm-sys.rs), which
|
||||||
|
//! provide very minimal bindings from the LLVM C-API to Rust. `reid_llvm`-crate
|
||||||
|
//! 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.
|
||||||
|
//!
|
||||||
|
//! Currently missing relevant features (TODOs) are:
|
||||||
|
//! - Arrays
|
||||||
|
//! - Structs (and custom types as such)
|
||||||
|
//! - Extern functions
|
||||||
|
//! - Strings
|
||||||
|
//! - Loops
|
||||||
|
//!
|
||||||
|
//! An example program of Reid, that calculates the 5th fibonacci number (and
|
||||||
|
//! uses Rust for highlighting) is:
|
||||||
|
//! ```rust
|
||||||
|
//! fn main() -> u16 {
|
||||||
|
//! return fibonacci(5);
|
||||||
|
//! }
|
||||||
|
//!
|
||||||
|
//! fn fibonacci(n: u16) -> u16 {
|
||||||
|
//! if n <= 2 {
|
||||||
|
//! return 1;
|
||||||
|
//! }
|
||||||
|
//! return fibonacci(n-1) + fibonacci(n-2);
|
||||||
|
//! }
|
||||||
|
//! ```
|
||||||
|
|
||||||
use mir::typecheck::TypeCheck;
|
use mir::typecheck::TypeCheck;
|
||||||
use reid_lib::Context;
|
use reid_lib::Context;
|
||||||
|
|
||||||
@ -11,13 +43,6 @@ mod pad_adapter;
|
|||||||
mod token_stream;
|
mod token_stream;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
// TODO (Missing Relevant Features):
|
|
||||||
// - Arrays
|
|
||||||
// - Structs (and custom types as such)
|
|
||||||
// - Extern functions
|
|
||||||
// - Strings
|
|
||||||
// - Loops
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum ReidError {
|
pub enum ReidError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
Loading…
Reference in New Issue
Block a user