Having fun with Scheme

@raviqqe

Index

  • Schemat: yet another Scheme formatter
  • Implementing Scheme in Rust

Schemat

  • Scheme code formatter
  • Written in Rust unfortunately...
  • Uses the same mfmt formatter library as Pen.
  • Rust allocator API + bumpalo crate

Schemat

Some features are not supported yet.

  • Range comments

    • #| This is a comment. |#
  • Multi-line strings

    "foo \
      bar"
    
    • Read flags 😭

Implementing Scheme in Rust

  • VM is mostly done.
    • Written in Rust
    • The core logic is around 700 lines.
      • Mostly re-implementation of Ribbit
    • No-std and no-alloc
    • Can be used as a library.
    • Copy GC
  • Bytecode compiler
    • Written in Scheme
    • Global variable get/set
  • But write codes in Scheme as much as possible.

Next tasks...

  • Scheme in Rust
    • More language features in the bytecode compiler
      • Closures
      • Slot variables
  • Pen
    • sort and reverse functions
    • Syntax extension for list pattern matching
    • Compiler improvements

Summary

  • Building a VM is fun (again.)