miking-lang / miking

Miking - the meta viking: a meta-language system for creating embedded languages
Other
51 stars 30 forks source link

Compiler Task Force - Master Issue #187

Closed elegios closed 2 years ago

elegios commented 3 years ago

This issue serves as the master issue for the current task of getting a compiler working for mexpr.

br4sco commented 3 years ago

So I have been thinking a little about the OCaml interface towards sequence and symbol intrinsics. The idea so far:

Create a module, named say Intrinsics, containing the ocaml versions of cons, snoc, makeSeq, etc., as well as gensym, eqsym (we could very well interface all intrinsics here instead of calling the corresponding operators in the generated ocaml code (or boot for that matter) directly e.g. (+), (-), ..., but maybe that is a bit excessive). I think this gives a nice clean interface to be made available in the generated ocaml code as well as in boot. However, we cannot directly use this module in boot since we internally rely on map, fold_right, etc over sequences (finger trees), so we would have to add these by extending Intrinsics in boot (using include in the module I guess).

david-broman commented 3 years ago

Good point. However, we have to double check so that we do not get an overhead in the compiled code due to an indirection via a module. Especially if (+), (-) etc. are included. I guess the only way to really check this is to inspect the generated assembly code.

br4sco commented 3 years ago

Intrinsics we can compile to ocaml and are tested.

br4sco commented 3 years ago

CNot is compiled but it doesn't exist in boot so it should probably be removed.