Implemented the chain rule optimization.
Made space in the call instruction for the number of permanent variables remaining.
Made space in the call instruction for the number of permanent variables remaining.
Set up call instructions with num permanent variables remaining set to all, this will be trimmed down later.
Renamed allocate to allocate_n, in preparation for the new allocate instruction that takes no arguments. allocate_n is still needed to create the initial environment frame to support queries.
Implemented the allocate instruction for environment trimming.
Implemented permanent variable allocation in reverse position of last occurrence order, for environmen trimming.
Added a test case for environment trimming.
Improved pretty printing on call to also display the number of remaining permanent variables.
Implemented the permanent variables remaining counting algorithm.
Added comment explaining the environment trimming ordering and counting of permanent variables remaining.
Environment trimming completed.
Removed commented out code.