Fix n vs n1 mistake
This commit is contained in:
parent
419ab937b6
commit
df051fd643

@ 334,10 +334,10 @@ code for the global function:




{{< gmachine "UnwindGlobal" >}}


{{< gmachine_inner "Before">}}


\( \text{Unwind} : i \quad a, a_0, a_1, ..., a_n : s \quad d \quad h[\substack{a : \text{NGlobal} \; n \; c \\ a_k : \text{NApp} \; a_{k1} \; a_k'}] \quad m \)


\( \text{Unwind} : i \quad a, a_0, a_1, ..., a_{n1} : s \quad d \quad h[\substack{a : \text{NGlobal} \; n \; c \\ a_k : \text{NApp} \; a_{k1} \; a_k'}] \quad m \)


{{< /gmachine_inner >}}


{{< gmachine_inner "After" >}}


\( c \quad a_0', a_1', ..., a_n', a_n : s \quad d \quad h[\substack{a : \text{NGlobal} \; n \; c \\ a_k : \text{NApp} \; a_{k1} \; a_k'}] \quad m \)


\( c \quad a_0', a_1', ..., a_{n1}', a_{n1} : s \quad d \quad h[\substack{a : \text{NGlobal} \; n \; c \\ a_k : \text{NApp} \; a_{k1} \; a_k'}] \quad m \)


{{< /gmachine_inner >}}


{{< gmachine_inner "Description" >}}


Call a global function.



@ 345,12 +345,12 @@ code for the global function:


{{< /gmachine >}}




In this rule, we used a general rule for \\(a\_k\\), in which \\(k\\) is any number


between 0 and \\(n\\). We also expect the `NGlobal` node to contain two parameters,


between 1 and \\(n1\\). We also expect the `NGlobal` node to contain two parameters,


\\(n\\) and \\(c\\). \\(n\\) is the arity of the function (the number of arguments


it expects), and \\(c\\) are the instructions to construct the function's tree.




The attentive reader will have noticed a catch: we kept \\(a\_n\\) on the stack!


This once again goes back to replacing a node inplace. \\(a\_n\\) is the address of the "root" of the


The attentive reader will have noticed a catch: we kept \\(a\_{n1}\\) on the stack!


This once again goes back to replacing a node inplace. \\(a\_{n1}\\) is the address of the "root" of the


whole expression we're simplifying. Thus, to replace the value at this address, we need to keep


the address until we have something to replace it with.






Loading…
Reference in New Issue
Block a user