A toy dynamic programming language written in Ruby
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

identifier.rb 315B

123456789101112131415161718192021
  1. class AST::Identifier
  2. attr_reader :name
  3. def initialize(name)
  4. @name = name
  5. end
  6. def ==(other)
  7. other.is_a?(AST::Identifier) && other.name == @name
  8. end
  9. def execute(env)
  10. value = env.get(@name)
  11. if value.respond_to?(:execute)
  12. value.execute(env)
  13. else
  14. value
  15. end
  16. end
  17. end