Commit 02aabbe2
02aabbe27a05Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
docs: add runnable example to Quick Start
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 02aabbe27a05
- Parent
- 80bdc083a4a0
README.mdmodifiedView file
@@ -37,16 +37,31 @@
3737
# Build everything:3838
make3939
40-
# Compile a Ruby program:40+
# Write a Ruby program:41+
cat > hello.rb <<'RUBY'42+
def fib(n)43+
if n < 244+
n45+
else46+
fib(n - 1) + fib(n - 2)47+
end48+
end49+
50+
puts fib(34)51+
RUBY52+
53+
# Compile and run:54+
./spinel hello.rb55+
./hello # prints 5702887 (instantly)56+
```57+
58+
### Options59+
60+
```bash4161
./spinel app.rb # compiles to ./app4262
./spinel app.rb -o myapp # compiles to ./myapp4363
./spinel app.rb -c # generates app.c only4464
./spinel app.rb -S # prints C to stdout45-
46-
# Or step by step with CRuby:47-
ruby spinel_parse.rb app.rb > app.ast48-
ruby spinel_codegen.rb app.ast app.c49-
cc -O2 app.c -lm -o app5065
```5166
5267
## Self-Hosting