Skip to content

Commit

Permalink
[Phase4] Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
liqwang committed Jan 11, 2024
1 parent 9042af2 commit b131d3c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions phase4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,29 @@

**12111611 Ruixiang Jiang**



## Design

### Procedure Call

#### Active Variables

Before function call, we only need to store the active variables before invoking the function

The active variables are stored in the set `active_vars`, which is easy to maintain

The set will be updated only in three cases:

- `x := ...`
- `PARAM x`
- `READ x`

We only need to add `x` to `active_vars` while translating the TACs

When we get TACs like `IF x [op] y GOTO label`, we **don't** need to add `x` and `y` to `active_vars`, because `x` and `y` must be already declared in the form of the above three cases

Finally, clear the set after getting a new function TAC `FUNCTION f :`



0 comments on commit b131d3c

Please sign in to comment.