Tutorial (link broken because bad word detector): drive google com/file/d/1vFMFJ4wmAaAj2kHwaxL5rNGcEcqSKRDk Micron is a powerful programming language for Scratch projects. Two big concepts introduced by Micron are: * User defined types: related variables can be grouped into a single data type which can then be used as one entity. * Macros: add your own features to the syntax! Fun fact: the 'for' loop is implemented as a macro. There is room for improvement, but I am nonetheless proud of how the language has come along so far. Dev version for future updates: https://scratch.mit.edu/projects/465672744/ The demo is the mandelbrot drawing program, but this time I cleaned it up by using for loops where applicable.
Special thanks to: @ogadaki for suggesting an improvement to the messaging system Everyone who has voiced support for development Feb 20(v0.2): 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 (v0.1): 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)