Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The choice of Scheme compiler #15

Open
Necr0x0Der opened this issue Nov 14, 2023 · 3 comments
Open

The choice of Scheme compiler #15

Necr0x0Der opened this issue Nov 14, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Necr0x0Der
Copy link
Contributor

Chicken Scheme looks ok, but other choices can be considered carefully in order to proceed further. There are other choices such as Dr.Racket or Guile with different approaches (e.g. compilation to a VM rather than to a shared library). We need to create a list of suitable Scheme compilers and analyze them in accordance with a number of properties, e.g.

  • speed of execution of compiled code (can be measured without integrating to MeTTa)
  • speed of compilation
  • flawless integration to MeTTa, i.e. will MeTTa code with compiled functions and grounded atoms be executable (like it is done for Chicken Scheme through textual representations and eval), or are there pitfalls
  • platform support and easiness of deployment (in particular, possibility to install by metta-morph itself without user actions; or possibility to install as a Python package)
  • availability of libraries and possibility to install them and make accessible from MeTTa without user actions
  • availability of API (besides CLI) for compilation either in Scheme itself or in one of C++/Rust/Python
  • compilation control and other features: compilation to shared libraries or/and RAM, detection of the necessity to recompile stuff between different runs, compilation error handling, etc.
  • support for type-checking [optional?]
  • ...
@patham9
Copy link
Collaborator

patham9 commented Nov 26, 2023

A first summary regarding Ambivalence and Matchable (the major workhorses of MeTTamorph) in other Scheme implementations:

Ambilavence in other Scheme implementations:
In October it was introduced to Gerbil (std/amb):
https://github.com/mighty-gerbils/gerbil/blob/master/CHANGELOG.md
In Racket:
https://planet.racket-lang.org/package-source/murphy/amb.plt/1/0/planet-docs/amb/index.html
In Guile, usable through a library on Gitlab:
https://gitlab.com/tojoqk/guile-amb
I will soon try whether the superpose macro for Chicken Scheme also works (or can adapted to work) with these amb implementations, and whether the depth-first search strategy matches.

Regarding Matchable: that one initially was on track to get standardized: https://srfi.schemers.org/srfi-204/srfi-204.html
This however did not happen, but the library is written in a portable way, written with the hygienic syntax-rules macro system, so will also work with the other Schemes with just minor modifications.
The source for Chicken Scheme is here:
https://code.call-cc.org/svn/chicken-eggs/release/5/matchable/trunk/
and the package description: http://wiki.call-cc.org/eggref/5/matchable

@patham9
Copy link
Collaborator

patham9 commented Dec 15, 2023

Some findings since last time:

  • Gerbil Scheme's amb implementation is a bit non-standard in Lisp/Scheme world as it demands an amb-begin application before each amb/amb-collect usage, which makes superpose implementation more difficult as it demands additional syntactic transformations which could unfortunately become non-trivial.
  • Gerbil Scheme does not allow calling POSIX fork and pipe functions directly, which means a parallel superpose would need a different approach than currently in Mettamorph.
  • Guile's amb misses a few functions such as amb1 to create ambivalence for each list item, but this should be fixable.
  • C interop with Guile and Racket seems like it will be slightly more complex than with Chicken Scheme and Gerbil.

I guess considering these points we can at least already eliminate Gerbil from the options?

@Necr0x0Der
Copy link
Contributor Author

Yes, Gerbil can be discarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants