Sha256: 4a7b8d55e9f1398659ae8c0db0f2ee5b86509c500f118b872969d8b2d8296db7
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module Mulang::Ruby module Sexp def sequence(*contents) if contents.empty? ms(:MuNil) elsif contents.size == 1 contents[0] else ms(:Sequence, *contents) end end def ms(tag, *contents) if contents.empty? {tag: tag} elsif contents.size == 1 {tag: tag, contents: contents.first} else {tag: tag, contents: contents} end end def simple_method(name, args, body) { tag: :Method, contents: [ name, [ [ args, {tag: :UnguardedBody, contents: body }] ] ] } end def mu_primitive_method(type, args, body) { tag: :PrimitiveMethod, contents: [ type, [ args, {tag: :UnguardedBody, contents: body }] ] } end def simple_send(sender, message, args) ms(:Send, sender, ms(:Reference, message), args) end def primitive_send(sender, op, args) ms(:Send, sender, ms(:Primitive, op), args) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mulang-ruby-5.0.0 | lib/mulang/ruby/sexp.rb |