/something

Programming with Something

Primary LanguageRubyCreative Commons Zero v1.0 UniversalCC0-1.0

Programming with Something

This code accompanies the RubyConf 2021 talk “Programming with Something”.

It consists of some support files plus a few different evaluators for the encodings from an earlier talk, “Programming with Nothing”:

  • Nothing — the original proc encodings
  • Something — an AST to represent those proc encodings, and a translator to build ASTs from procs
  • Something::Interpreter — an AST interpreter
  • Something::RubyVM::Interpreted — a Ruby implementation of the SECD machine which interprets an expression
  • Something::NativeVM::Interpreted — a C implementation of the SECD machine which interprets an expression
  • Something::RubyVM::Compiled — a Ruby implementation of the SECD machine which compiles an expression to commands in advance
  • Something::NativeVM::Compiled — a C implementation of the SECD machine which compiles an expression to commands in advance

To run the tests:

$ make
$ bundle install
$ bundle exec rspec

To run one of the demo FizzBuzz implementations:

$ make
$ bundle exec ruby demo/something_native_vm_compiled.rb

Please see the talk page for more details.