Hongbo Zhang, the main developer of the programming language rescript , has presented a new programming language called Moonbit . This language is specially optimized for creating applications compiled in the universal intermediate code of Webassembly. The development of MoonBit aims to provide a simple syntax, high compilation speed, and the generation of compact and fast intermediate Webassembly code. Several backends are available for generating code, including backends for JavaScript and native code.
The need for a new language arises from the complexity and slow compilation associated with developing Webassembly applications in low-level languages like C++ and Rust. Although higher-level languages like Go are easier to study and write programs in, they lag behind in terms of effectiveness and compactness of the resulting code. The MoonBit developers aimed to combine the best aspects of low-level and high-level languages in the context of using them with Webassembly technology.
To achieve high-performance programs, the MoonBit compiler utilizes a multi-level intermediate code called mlir , which allows for additional optimizations that take into account control and data flow graphs. This also enables more efficient utilization of the processor cache. The use of Mlir also optimizes and eliminates excessive structures at a higher level, considering the program’s structure.
To improve assembly speed and integration with the development environment, MoonBit supports parallelization of operations during compilation. It performs semantics analysis at the function level and can efficiently reverse only changed code. In order to minimize the size of the generated code, MoonBit initially does not support structures that may interfere with the identification and removal of unused code. The structure of the standard library is also optimized to include only the code in demand.
The language supports various programming paradigms, including elements of object-oriented and functional programming. It provides a simple type system and an architecture