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 make
3939
40-# Compile a Ruby program:
40+# Write a Ruby program:
41+cat > hello.rb <<'RUBY'
42+def fib(n)
43+ if n < 2
44+ n
45+ else
46+ fib(n - 1) + fib(n - 2)
47+ end
48+end
49+
50+puts fib(34)
51+RUBY
52+
53+# Compile and run:
54+./spinel hello.rb
55+./hello # prints 5702887 (instantly)
56+```
57+
58+### Options
59+
60+```bash
4161 ./spinel app.rb # compiles to ./app
4262 ./spinel app.rb -o myapp # compiles to ./myapp
4363 ./spinel app.rb -c # generates app.c only
4464 ./spinel app.rb -S # prints C to stdout
45-
46-# Or step by step with CRuby:
47-ruby spinel_parse.rb app.rb > app.ast
48-ruby spinel_codegen.rb app.ast app.c
49-cc -O2 app.c -lm -o app
5065 ```
5166
5267 ## Self-Hosting