Skip to content

Commit

Permalink
[DOC] adding more crate level debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed Jul 12, 2024
1 parent f328d29 commit 64b69c9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
34 changes: 33 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,39 @@
#![allow(clippy::redundant_field_names)]
#![allow(rustdoc::invalid_html_tags)]

//! Ygen - <b>Y</b>et another Code <b>Gen</b>erator
//! # Ygen - <b>Y</b>et another Code <b>Gen</b>erator
//! ### Description
//! Ygen is a libary to build modern compilers and tools <br>
//! It includes many features like IR Optimization, Argument parsing, and much more <br>
//! There are many utility functions and classes to help you write many asspects of your compiler: <br>
//! - Like the Colorize trait to colorize your strings (maybe used for printing errors)
//! - The TokenMngr in combination with the SrcMngr to easily write a lexer and store the source location (usefull for including
//! debugging information)
//!
//! #### The YGEN-IR
//! The Ygen Internal Representation isn't very different to LLVMs IR. <br>
//! A tip: <br>
//! To dump the Ir of a YGen-Module use the `dump`-Function which dumps the entire IR into a string <br>
//! If you want to print the IR out the stdout consider using the `dumpColored`-Function which includes Color Information <br>
//! But if you pipe that into a file it also includes the Color bytes which then look a bit sus so consider printing it to stderr
//!
//! ###### Here is a quick introduction to the YGEN-IR:
//! A function is defined like this:
//! ```
//! define i32 @add( i32 %0, i32 %1 ) {
//! entry:
//! %2 = add i32 %0, %1
//! ret i32 %2
//!}
//! ```
//! So `define` then the return type of the function, a `@`, the function name and the arguments. <br>
//! An important thing to understand is that you can only define every variable once because
//! it follows the SSA form. <br>
//!
//! In YGEN-iR there are many inbuild instructions
//! Like in our add function example:
//! - `add` adds two numbers
//! - `ret` returns an constant or a variable

/// The target module: every stuff which has to do with targets. Like:
/// * The target triple
Expand Down
20 changes: 19 additions & 1 deletion tools/ygen-mc/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
#![allow(rustdoc::invalid_html_tags)]

//! # `ygen-mc`: Ygen machine code code playground
//! With the ygen machine code playground you can play around with assembler instructions
//! and see their opcodes. <br>
//! It's suppused to being the Ygen variant of the `llvm-mc`
//! ### Usage
//! **Options:** <br>
//!
//! > **-h, --help** Displays help<br>
//! > **-v, --version** Displays the version<br>
//! > **-clr, --color** Colorates the ouput<br>
//!
//! **Arguments:** <br>
//!
//! > **-as=<val>, --assemble-string=<val>** The assembly instruction to assemble <br>
//! > **-triple=<val>, --triple=<val>** The target triple <br>

use Ygen::Support::Cli;

fn main() {
let mut cli = Cli::new(
"ygen-mc", "Ygen's machine code playground", "1.0", "Cr0a3"
"ygen-mc", "Ygens machine code playground", "1.0", "Cr0a3"
);

cli.add_opt("h", "help", "Displays help");
Expand Down

0 comments on commit 64b69c9

Please sign in to comment.