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

variable_declaration.rb 313B

1234567891011121314151617
  1. class AST::VariableDeclaration
  2. attr_reader :name, :value
  3. def initialize(name, value)
  4. @name = name
  5. @value = value
  6. end
  7. def ==(other)
  8. other.is_a?(AST::VariableDeclaration) && other.name == @name &&
  9. other.value == @value
  10. end
  11. def execute(env)
  12. env.set(@name.name, @value)
  13. end
  14. end