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

Look at very similar Prolog/Datalog-based project Makam #374

Open
safinaskar opened this issue Apr 9, 2023 · 0 comments
Open

Look at very similar Prolog/Datalog-based project Makam #374

safinaskar opened this issue Apr 9, 2023 · 0 comments

Comments

@safinaskar
Copy link

Hi. Let me tell you about some projects very similar to what you are doing.

Let's start with Makam ( https://github.com/astampoulis/makam ). This is prolog/datalog-based language for specifying syntax and semantics of programming languages, for playing around and arguing about programming languages semantics. Makam is implemented in Ocaml.

Makam is a very similar language to your Datalog dialect. For example, here is example from their manual:

typeof (plus A B) tint <- typeof A tint, typeof B tint.

Makam has a lot of advanced features: lambda expressions, ability to very succinct implicit context (i. e. scope) handling (but I personally consider this as a misfeature, I like explicit contexts), special features for list handling (i. e. for dealing with target language's lists), etc.

Makam is so powerful that you can write whole interpreter in it (see details in their blog).

Makam is able to parse target language using PEG ( http://astampoulis.github.io/blog/makam-tutorial-01/ ). Parsing is bidirectorial (!). Parsing is somehow implemented using JS (but I'm not sure exactly how Ocaml parts and JS parts are related).

(Now let me insert one self-advertisement note here: every time I see "bidirectorial parsing" somewhere, I'm very skeptical about it. Very often so-called bidirectorial parsing projects turn out to be not sound. But I wrote a CFG-based Haskell library, that allows you to write bidirectorial parser with actual guaranteed soundness, i. e. my library guarantees bidirectionality. Here is link: https://mail.haskell.org/pipermail/haskell-cafe/2021-July/134217.html . I can show you other my Haskell parsing libs.)

Makam code can be evaluated directly in browser. At link above you can simply click to "Evaluate code" button in the corner and see result of code evaluation. You can edit code, too.

Unfortunately, Makam is not designed for implementing IDE, it is for writing interpreters and arguing about language semantics. So this will be very cool to somehow combine your IDE with great Makam features and its ability to implement full-featured interpreter.

Also Makam is typed.

This article https://www.tweag.io/blog/2019-11-28-PCF-makam-spec/ can be seen as simple introduction to Makam.

Makam is instance of broad category of Lambda-Prolog. Here is list of various Lambda-Prolog-based projects: http://www.lix.polytechnique.fr/~dale/lProlog/ . Lambda-Prolog can be described as Datalog, but typed, and with lambda expressions.

In particular see this cool demo: https://trymlts.github.io/ . This is playground for toy language MLTS. Interpreter for MLTS is implemented in Lambda-Prolog. And Lambda-Prolog can be run in browser. So this is similar to your demo. In both cases we implement simple language (FP or MLTS) in prolog/datalog-like language (Datalog and Lambda-Prolog, which are very similar). But in your case we see IDE without runner, and they have runner with editor, but without full-featured IDE

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

No branches or pull requests

1 participant