v1.2.2 variable scoping and web export fix
MotC version 1.2.2 has been released.
Variable scopes
"for", "while", "if" and "else" statements now create variable scopes. Variables declared within a scope are deallocated when the program exits the scope, and variable names can be re-used in separate (non-overlapping) scopes.
Variables declared in "for" loop initialisers are also considered part of the "for" loop scope.
This is a breaking change! But I think it's worth it for the cleaner code. Fixing up old programs should be pretty straightforward.
Web export
Programs exported to web can now access files in sub-folders (so long as you have included them using the #file directive).
Previously the file would fail to open at runtime unless they were in the root folder.
Garbage collector improvements
Some under-the-hood changes have been made to the automatic garbage collector to help it better reclaim memory:
- The memory reference format has been reworked to reduce collisions with small integers
- A quicker non-compacting garbage collection is run after every 5000 allocations, so identify and re-use allocation table entries
Miscellaneous
- `stat(MEMORY_FULLGCCOUNT)` can be used to return the count of full (compacting) garbage collections. `stat(MEMORY_GCCOUNT)` returns the count of all garbage collections (compacting or otherwise).
- New elapsed time functions:
- `timer()` returns the number of seconds since the program started.
- `resettimer()` resets the timer to 0.
- The sample programs have been tidied up a little. #file directives have been added to those that reference files, so that they can be exported as-is.
Files
Get MotC
MotC
Retro game development tool
Status | Released |
Category | Tool |
Author | Tom Mulgrew |
Tags | compiler, development, Retro, tool |
More posts
- v1.2.56 days ago
- v1.2.4 constants and parameter default values87 days ago
- v1.2.3 mousewheel() and minor fixesAug 31, 2024
- v1.2.1 add support for array based for loopsAug 01, 2024
- v1.2.0 - Intellisense releaseJul 28, 2024
- Windows export fixApr 18, 2024
- v1.1.0Feb 18, 2024
- v1.0.2Jan 21, 2024
- MotC 1.0.1 (fullscreen mode)Dec 31, 2023
Leave a comment
Log in with itch.io to leave a comment.