A toy dynamic programming language written in Ruby
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

hash.rb 287B

123456789101112131415161718192021
  1. class AST::Hash
  2. attr_reader :data
  3. def initialize(data)
  4. @data = data
  5. end
  6. def ==(other)
  7. other.is_a?(AST::Hash) && other.data == @data
  8. end
  9. def execute(env)
  10. result = Hash.new
  11. @data.each do |k, v|
  12. result[k] = v.execute(env)
  13. end
  14. result
  15. end
  16. end