micro-mitten: simple Rust-like lang with compile-time memory management

栏目: IT技术 · 发布时间: 5年前

内容简介:metal's too hot? wear a mitten!Like Rust,

micro-mitten

metal's too hot? wear a mitten!

micro-mitten ??

micro-mitten is a bare-bones Rust-like programming language, stripped down to simplify control-flow structures and the type system.

Like Rust, micro-mitten offers a static approach to memory management; however, micro-mitten 's approach is significantly different from Rust's. Rather than depending on single ownership and a complex lifetime system, micro-mitten uses a series of data-flow analyses to statically approximate heap liveness. This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code. The theory behind the approach is documented in this thesis (Proust 2017).

Long story short, this is an attempt to see if we really can have unrestrictive compile-time garbage collection.

How can I use it?!

The project depends on libgc and the LLVM-8 toolchain. Cloning this repository and running the following should get you set up with a working copy of mmtnc (the micro-mitten compiler).

./tools.sh # installs `mitten-test`, `mitten-bench`, `knit` and the language runtime
cargo install --path ./ --force # installs `mmtnc`

mmtnc compiles .mmtn files to LLVM IR ( .ll ) and just dumps the textual representation. Much more helpfully, you can get binaries directly using knit . To build a binary ( example ) from a source file ( example.mmtn ) use:

knit --src example.mmtn --gc-strategy=proust

The --gc-strategy argument is optional, but the default is to use no garbage collection (your computer will hate you). The other options are proust (uses static memory management) and bdw (uses libgc ).

Notes

To get an idea of the language syntax, check out the examples in src/test/ . If you get something wrong, the compiler shoud moan at you. Otherwise, please open an issue!

Please note, micro-mitten is purely a research language and its performance is not brilliant when using static memory management. For a full run-down, see my dissertation . Most of the examples in src/test/ will run with static memory management, but there are some notable exceptions and one or two memory leaks.


以上所述就是小编给大家介绍的《micro-mitten: simple Rust-like lang with compile-time memory management》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

網絡社會之崛起

網絡社會之崛起

曼威·柯司特 / 夏鑄九、王志弘 等 / 唐山 / 2000-11 / NT$550

本書解釋了今日重塑世界的兩股強大但相互衝突的潮流:全球化與認同。資訊科技的革命以及資本主義的再結構已經引動了網絡社會,並帶來了策略,除經濟行為的全球化、工作的彈性化與不穩定,以及真實的虛擬文化。但是,伴隨著資本主義的轉化與國家主義的消亡而來的,是集體認同的表達以火力十足的方式竄起。它們挑戰了全球化中的文化單一性以及對於生活、環境的控制。曼威.柯司特在本書中描繪了社會運動的根源、目標以及效果,包括了......一起来看看 《網絡社會之崛起》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试