mm0 icon indicating copy to clipboard operation
mm0 copied to clipboard

mm0-rs as a library

Open digama0 opened this issue 5 years ago • 3 comments

This is a tracking issue for mm0-rs as a library:

  • Have an API for usage from other rust projects, deploy on crates.io
  • Make the API usable using C bindings so that other languages (e.g. Python) can also use it

The details of the API are TBD, but might include REPL-like usage where you give MM1 commands and get them elaborated, and a query API for the Environment object.

digama0 avatar Aug 04 '20 13:08 digama0

regarding python in particular, pyo3 should be much easier than going throught hand made C bindings.

c-cube avatar Aug 04 '20 14:08 c-cube

I see. The plan was not to make any particular reference to python in mm0-rs, but rather have some generic bindings that can be used in whatever setting. I guess the easiest way to do python bindings specifically would be to use mm0-rs as a pure rust library, and have the main application be a python shim using pyo3 which links with mm0-rs.

digama0 avatar Aug 04 '20 15:08 digama0

Yes, you can make a separate crate that uses pyo3 and generates a .so file (or .dynlib I guess) that is also a native python module. I wouldn't dare suggest to add python directly into mm0-rs :grin:

c-cube avatar Aug 04 '20 15:08 c-cube