Skip to content

Commit

Permalink
Merge pull request #26 from lambdaclass/better
Browse files Browse the repository at this point in the history
better
  • Loading branch information
edg-l authored Dec 11, 2024
2 parents 190ae79 + 673d20a commit 34d6854
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/src/workshop_p6.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ With this dialect you don't need to add extra blocks, since the control flow wil

The only limitation is that we can't do early returns this way, but for this simple language it won't matter.

> You will need to clone the `locals` HashMap inside the created regions to avoid lifetime issues. But since any variable created
inside the if or else block only live for that scope, it works good.

```rust
// src/codegen/ifelse_stmt.rs
pub fn compile_if<'ctx, 'parent>(
Expand Down
2 changes: 2 additions & 0 deletions docs/src/workshop_p8.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Now to wrap up the function itself needs to be created, using the `func` dialect

You also need to allocate space for the arguments, and store the value there. You can get the value from the block arguments.

Remember that in this language functions always return a i64 value.

Some useful types you will need: `Type`, `IntegerAttribute`, `IntegerType`, `FunctionType`, `TypeAttribute`, `StringAttribute`.

```rust
Expand Down

0 comments on commit 34d6854

Please sign in to comment.