Open
Description
compileFn
returns
data VarIdx = Local Int | Temp Int | NoRes
compileFn :: ... -> (VarIdx, [Instructions])
instead of the whole stack thing, when encountering a variable decl, introduce a new Local
, and when compiling an expression, a new Temp
.
That probably means a State
that keeps:
Local
mappingMap String Local
(local name => var idx).
Without shadowing, otherwise need to find a different way)- The last
Temp
seen (and a functionnewTemp
that increments the one in theState
and returns it).
Metadata
Metadata
Assignees
Labels
No labels