This demo renders a 3D octahedron. It runs better in Turbo mode, probably because I rely on messages to pass data to the renderer. (I could work around this by implementing a write buffer in memory, but I didn't feel like doing it) It shouldn't be compared to the CRIS demo for performance because the implementations are notably different. Most notably, this implementation does not use dynamic allocation at all (which is possible because Micron has support for custom data types). Everything being stored on the stack also has the benefit of faster lookup times. Another difference is that this implementation computes the rotation as one 3*3 matrix instead of as 3 different rotations, which should be a bit faster. The 3D sorting is a bit glitchy at times, but I do not believe that this is due to a bug in the compiler.
Special thanks to: @ogadaki for suggesting an improvement to the messaging system Everyone who has voiced support for development March 6: Added support for atomic macros (macros which are invoked from an atom instead of an s-expression) Fixed a preprocessor bug which caused unexpected variable substitution March 5: 'if' statements are simplified if condition evaluates to a constant March 4: Added optimization for (= x 0) and (!= x 0) type statements Fixed implementation of jmpn0 opcode Implemented tail call optimization. March 1: Made preprocessor more efficient Implemented pointer operator overloads for addition and subtraction Implemented v-arg 'get' operator using macro Feb 28: Fixed a bug regarding type identification of variables Began rebuilding Micron around the macro system, which will hopefully make the compiler smaller 'Set' operator now handles undersized input reasonably and throws an error if oversized input is given. Feb 20: Added a macro for left-hand folding (foldl!) and a macro to define macros for folding a given function or operator Feb 18: Fixed the compiler slowing to a crawl when propagating constants Got macros that define other macros to work properly. Re-implemented equality operators and relational operators as macros, this way they handle 3+ arguments in a sensible manner. Implemented loop constructs until!, while! and for! using the macro system Feb 17: Implemented the core of the macro system (preprocessor). Feb 16: Implemented remaining operator from (operators) section in Scratch: "contains?", charat (letter x of y but with operator order reversed), random, round, abs, floor, ceiling, sqrt, tan, asin, acos, atan, ln, log, e^, 10^ Began work on the preprocessor. Feb 15: Fixed a bug where declaring a static variable left stuff on the stack Compiler detects unknown data types Feb 14: Undid a change from earlier that made the runtime slow. Project broke (stage was off center, 'say' block in puppet would say '10000' even if it was "Say [Hello!] for 2 seconds"). Really strange but it fixed itself Fixed improper handling of variable declarations Feb 13: Compiler ensures that only functions may be called as functions Created a working memory allocator supporting malloc and mfree 'def' is now 'local', to better distinguish local variables from static variables. Added 'pause' button to pause and resume program execution. Feb 12: Static memory is fully supported. Added 'pget' for accessing a struct via pointer Added several compiler checks Feb 11: 'If' statements which return a value must have a default branch Static variables may be declared. The call stack starts where statically allocated memory ends. Feb 10, 2021: can detect when 'break' and 'return' statements are used as input to an expression Feb 9, 2021: Improved message handling: message arguments are now popped by Micron instead of the message recipient. This prevents errors in the case of no recipients or several recipients. (Suggested by ) Feb 4, 2021: Added C-style inline comments: /*comment*/ Added overloads for operators +,- to add/subtract numbers from pointers. The pointer must be the first item in the list. Feb 3, 2021 (v1): Added automatic storage of structs. Fixed bug where structs would be reversed when loaded. Feb 2, 2021: Structs almost fully implemented. Only problem is that structs must be stored in a variable before being used. Feb 1, 2021: Implemented low-level faculties for structs. Jan 31, 2021: Began work on a type system for data. Jan 29, 2021: Added support for dereference / un-dereference operators. Compiler detects when an expression cannot be un-dereferenced. Jan 21, 2021: keyword 'cf' no longer required to invoke a function. Keyword 'progn' must be used for compound blocks. Jan 19, 2021: fixed bugs with processing statements. Generalized 'if' statement. Jan 17, 2021: Implemented basic instruction set and optimization for jumps (branching and looping). Added more stuff to Micron Jan 14, 2021: Added support for automatic constant propagation and instruction compression. Implemented a few more instructions. Started work on Micron, a simple programming language that compiles to ScratchAssembly. Jan 13, 2021: implemented layer 3 with functions, loops, etc Previously: implemented half of planned machine code. layer 1 (before numberization of instructions), layer 2 (before rearrangement of fixed arguments)