Skip to content
项目

关于

一个正在开发中的 Ruby 编译器,使用 Ruby 和 Rust 编写

编程语言与运行时

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
-1
1个月
0

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Natalie

GitHub build status MIT License justforfunnoreally.dev badge

Natalie is a work-in-progress Ruby implementation.

It provides an ahead-of-time compiler, written in Ruby, using LLVM with a Rust runtime. Also, the language has a REPL that performs incremental compilation.

demo screencast

There is much work left to do before this is useful. Please let me know if you want to help!

Building

Natalie is tested on macOS and Ubuntu Linux. Windows is not yet supported.

Install Nix, then enter the development shell (or let direnv enter it for you) and build:

nix develop
bundle install
rake

Usage

REPL:

bin/natalie

Run a Ruby script:

bin/natalie examples/hello.rb

Compile a file to an executable:

bin/natalie -c hello examples/hello.rb
./hello

Running Tests

Natalie runs ruby/spec and its own spec-style tests with MSpec. Initialize ext/mspec with git submodule update --init ext/mspec if it is missing. To run a single spec:

bin/natalie -Itest/support -rspec spec/core/string/strip_spec.rb

This will run the tests and tell you if there are any failures.

If you want to run all the tests that we expect to pass, you can run:

rake test

Lastly, if you need to run a handful of tests locally, you can use the test/runner.rb helper script:

bin/natalie test/runner.rb test/natalie/if_test.rb test/natalie/loop_test.rb

What's the difference between the 'spec/' and 'test/' directories?

The files in spec/ come from the excellent ruby/spec project, which is a community-curated repo of test files that any Ruby implementation can use to compare its conformance to what MRI (Matz's Ruby Interpreter) does. We copy specs over as we implement the part of the language that they cover.

Everything in test/ is stuff we wrote while working on Natalie. These are tests that helped us bootstrap certain parts of the language and/or weren't covered as much as we would like by the official Ruby specs. We use this to supplement the specs in spec/.

Copyright & License

Natalie is copyright 2025, Tim Morgan and contributors. Natalie is licensed under the MIT License; see the LICENSE file in this directory for the full text.

Some parts of this program are copied from other sources, and the copyright belongs to the respective owner. Such copyright notices are either at the top of the respective file, in the same directory with a name like LICENSE, or both.

file(s) copyright license
abbrev.rb Akinori Musha BSD
benchmark.rb Gotoken BSD
bigint.{h,c} 983 Unlicense
cgi.rb/cgi/* Wakou Aoyama BSD
crypt.{h,c} The Regents of the Univ. of Cali. BSD
delegate.rb Yukihiro Matsumoto BSD
dtoa.c David M. Gay, Lucent Technologies custom permissive
erb/util.rb Masatoshi SEKI BSD
ipaddr.rb Hajimu Umemoto and Akinori Musha BSD
find.rb Kazuki Tsujimoto BSD
formatter.rb Yukihiro Matsumoto BSD
linenoise S. Sanfilippo and P. Noordhuis BSD
matrix.rb/matrix/* Marc-Andre Lafortune BSD
minicoro.h Eduardo Bart MIT
net/ftp.rb Shugo Maeda BSD
net/http*/net/protocol.rb Yukihiro Matsumoto and Minero Aoki BSD
pp.rb Yukihiro Matsumoto BSD
prettyprint.rb Yukihiro Matsumoto BSD
resolv.rb Tanaka Akira BSD
shellwords.rb Akinori MUSHA BSD
spec/* Engine Yard, Inc. MIT
timeout.rb Yukihiro Matsumoto BSD
unicode_normalize/* Ayumu Nojima and Martin J. Dürst BSD
uri.rb/uri/* Akira Yamada BSD
version.rb Engine Yard, Inc. MIT
zlib Jean-loup Gailly and Mark Adler zlib license

See each file above for full copyright and license text.

探索相关项目

加载中…