lojikil / coastML

a tiny experimental ML dialect combining Yeti & CarML
ISC License
12 stars 0 forks source link

Subcompiler work #1

Closed lojikil closed 1 year ago

lojikil commented 1 year ago

This basically shims the sub-compiler into the Compiler object itself, but doesn't force it's use. The sub-compiler has a bunch of interesting things that we may wish to refactor into the compiler proper:

  1. spaghetti stacks instead of individual dicts/lists
  2. environment frames, which are themselves spaghetti stacks of the various environment members
  3. checks to see if operators are defined
  4. basic checking of case then blocks

This is good enough to merge now, but definitely think we probably want to refactor all of this code: make one compiler that walks through and can do all of these checks, similar to how the sub-compiler itself works. Since the shims are there, we literally could just flip the switch and make this the compiler; more work needs to be done on case & fn forms (in fact, all callables), and impl & sig aren't there yet, but it's an interesting start.