Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sonota88/ruccola
A self-hosting toy compiler
https://github.com/sonota88/ruccola
compiler programming-language ruby
Last synced: 1 day ago
JSON representation
A self-hosting toy compiler
- Host: GitHub
- URL: https://github.com/sonota88/ruccola
- Owner: sonota88
- License: mit
- Created: 2021-03-06T01:39:51.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-05T23:22:49.000Z (12 months ago)
- Last Synced: 2024-01-06T00:51:34.405Z (12 months ago)
- Topics: compiler, programming-language, ruby
- Language: Ruby
- Homepage:
- Size: 878 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is my hobby project to learn compiler implementation.
素朴な自作言語Ruccolaのコンパイラをセルフホストした
https://qiita.com/sonota88/items/1e683276541cf1b87b76See also: [selfhost/README.md](selfhost/README.md)
# Example
[examples/fibonacci.rcl](examples/fibonacci.rcl)
```ruby
#include ../selfhost/lib/std.rcldef fib(n)
case
when (n < 0)
_panic();
when (n < 3)
return n;
else
return fib(__sub(n, 2)) + fib(__sub(n, 1));
end
enddef main()
var n = 0;while (n < 21)
print_i(n);
putchar(C_SPC());
print_i(fib(n));
putchar(C_LF());n = n + 1;
end
end
```