Skip to content

software-meeting/alenvers

Repository files navigation

Alenvers

Toy Scheme interpreter based on the Revised Report on the Algorithmic Language Scheme (A. Shinn, J. Cowan, A. Gleckler).

Goals

  • Should be fully composable with ranges.
  • Extremely modular; should be a matter of one line of code to embed a VM or compile to IR.
  • Invalid state should be caught as early as reasonable
  • Make Invalid States Unrepresentable + DOD as possible
  • Full R7RS implementation

Log

(31/10/25) UPDATE:

Quite happy with the design currently. Might make the transitions member functions because i do not see a benefir to a standalone transition table. Also, I want to somehow make the state machine aware of when we are at the end of the file so it can regurgitate whatever it has in its mouth as an identifier or something if it hasn’t matched anything yet. Possible implementation:

  • If m_it == m_end, send char_eof to the state machine. That way, we don’t introduce more coupling, and the state machine can still work with its naive chars-as-events model.

(01/12/25) UPDATE:

Finally at a point where I am happy with the structure of the lexer. A few breakthroughts:

  • storing relevant state in the transition table, basically using it as a stack frame means API boundary very clearly drawn
  • should_consume_tag: this was a stroke of genius. define certain tokens that mean that the state machine should not advance the file pointer
  • using a range from an istreambuf_iterator -> istream is too high level an abstraction, i’m only ever getting chars anyways

About

Toy Scheme Interpreter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published