(→Postfix Code) |
(→Postfix Code) |
||
Line 17: | Line 17: | ||
The Postfix code for the above function is as follows: | The Postfix code for the above function is as follows: | ||
− | + | {{CollapsedCode|Postfix code| | |
<asm> | <asm> | ||
TEXT | TEXT | ||
Line 129: | Line 129: | ||
RET | RET | ||
</asm> | </asm> | ||
+ | }} | ||
== Compiling and Running == | == Compiling and Running == |
Consider the following C function:
<c> int *traverse(int vec[], int lim) {
int *ptr = vec + lim - 1, ix = lim - 2; while (ix >= 0) { ptr = (vec[ix] > *ptr) ? vec + ix : ptr; ix--; } return ptr;
} </c>
The Postfix code for the above function is as follows:
Postfix code |
---|
{{{2}}} |
To compile the Postfix code directly, pf2asm can be used:
pf2asm traverse.pf yasm -felf traverse.asm