GSET
Targets

Ruby Target

puts, begin/rescue/ensure, and Ruby-flavored output.

Implemented

gset run foo.rb defaults to the Ruby target; --target ruby forces it. Generated files are Ruby scripts executed with ruby.

Mapping table

GSETRuby output
print(...), say, echo, putsputs(...)
true/falsetrue/false
nullnil
arrays / maps[...] / {...}
if/elif/elseif/elsif/else + end
whilewhile … end
for…infor … in … end
functionsdef name(...) … end
try/catch/finallybegin / rescue / ensure / end
throwraise
****

Verified example

$ gset run hello.rb --target ruby
name = "World"
count = 3
puts("Hello, " + name)
while count > 0
    puts(count)
    count = count - 1
end

Output:

Hello, World
3
2
1

Watch out

  • then and do: the emitter uses end-terminated blocks (no do/then required thanks to newline parsing).
  • Class flow: Ruby forces class definitions at the top level; today's class-shell support works for declarations but method bodies aren't emitted yet.
  • Blocks vs lambdas: GSET lambdas become def wrappers rather than Ruby ->() {}; behavior matches for direct calls.
  • Runtime not present on all dev boxes: this repo's dev machine has no ruby binary, so Ruby output is verified by transpile. Install Ruby to run it.

Runtime

Requires ruby on PATH. Override with compiler.ruby.command in gset.conf.

On this page