In the realm of programming, syntax analysis, commonly referred to as parsing, plays a pivotal role during the compilation process. The parser's primary responsibility is to transform a stream of tokens into an abstract syntax tree (AST).
In this article, we will introduce Pratt parsing, a renowned algorithm for parsing, often recognized as top-down operator precedence parsing, and we will demonstrate how to implement it using MoonBit.
You can experience the Pratt parsing code in this blog at https://try.moonbitlang.cn/#99b19baf.
People who grew up in the '80s and '90s remember Tetris. For decades, the game has challenged our hand-eye coordination and ability to make snap decisions. Tetris hasn't gone anywhere—it's still around, playable on just about any device.
Last week, a MoonBit user named Luoxuwei shared his Tetris implementation code using MoonBit on GitHub, presenting an interesting coding exercise. Today, we'll utilize Luoxuwei's code as a practical example to illustrate how to program Tetris using MoonBit.
It has been two weeks since we officially launched the Moonbit. We've witnessed numerous users eagerly diving into various projects with Moonbit over this time. Woonki, an engineer hailing from the renowned GreenLabs company, is one of them, and he excitedly shared on Twitter his latest endeavor: using Moonbit to revamp the classic Game of Life. Notably, Moonbit's outstanding compilation speed during this project has truly astounded him.