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 encodingsSomething
— an AST to represent those proc encodings, and a translator to build ASTs from procsSomething::Interpreter
— an AST interpreterSomething::RubyVM::Interpreted
— a Ruby implementation of the SECD machine which interprets an expressionSomething::NativeVM::Interpreted
— a C implementation of the SECD machine which interprets an expressionSomething::RubyVM::Compiled
— a Ruby implementation of the SECD machine which compiles an expression to commands in advanceSomething::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.