effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
321 stars 23 forks source link

Artifact for PLDI 2022 #242

Closed hflsmax closed 1 year ago

hflsmax commented 1 year ago

Hi, I'm a graduate student and would like to test out the CPS translation presented in “A Typed Continuation-Passing Translation for Lexical Effect Handlers”.

Does this repository contain relevant artifact? If so, what commit should I use to test it out?

b-studios commented 1 year ago

Hey, thanks for your interest in our work! First of all, we do not have a specific artifact for the PLDI submission. IIRC, we had Coq proofs that accompanied the paper, but that is all.

In the end, our research of the PLDI paper is targeted towards the implementation that you can find in this repo (and the Effekt language). We have several backends that use the lift inference and evidence passing discussed in the PLDI paper. The most stable one is the chez-lifted backend.

The best way to explore this is to install the VSCode plugin and then change the settings in the plugin to show the lifted-core representation. You can also play around on the website (which is never fully up to date, sadly):

https://effekt-lang.org/docs/implementation/lift-inference

The lifted trees that are shown on the website do not show types (which is a recent addition in our implementation) and which we should update.

So TDLR:

Let us know if you have more questions or need any help (which is to be expected, to be honest, since the documentation is not nearly complete).

hflsmax commented 1 year ago

Thanks for your detail answer! Which backend do you think produces the fastest binary?

b-studios commented 1 year ago

Which backend do you think produces the fastest binary?

Difficult to say, both the LLVM backend as well as the MLton backend are quite fast. However, both are still under development and only cover a subset of the language. What examples are you planning to play around with? Any idea already? Maybe we can help with it?

To run a specific backend, you can use the --backend flag. For instance:

effekt --backend llvm examples/llvm/...

or from within sbt

sbt> project effektJVM
sbt> run --backend llvm examples/llvm/....
hflsmax commented 1 year ago

I'm having problem getting the master branch built. After running sbt update, sbt install gives these error. Sorry I've not work with Scala before and don't know how to resolve these dependency issues. Any pointers?

compile_error.txt

b-studios commented 1 year ago

No worries, that is normal. Have you seen this guide?

https://effekt-lang.org/contributing.html

It seems the git submodules are not cloned. So maybe run

git submodule init
git submodule update

sometimes it helps to remove the kiama folder and then run the above two commands again. Setting up the submodules only has to be done once (sadly correctly).

hflsmax commented 1 year ago

Thanks. I'm trying to run benchmark/triples.effekt as a first step. I tried different backends.

Both ml and chez-lift works.

For js, I'm not sure how to run the produced js code. Executing node out/triples.js doesn't really run the program. Any advice?

For LLVM, I encountered this error.

effekt.sh -c triples.effekt --backend llvm
[error] triples.effekt:1:1: Cannot find source for io/args
import io/args
^^^^^^^^^^^^^^
b-studios commented 1 year ago

Hey, sorry for the late reply. The JS backend goes into a monad and so you need to load the file and then call run on main:

node --eval "require('./FILE.js').main().run()"

(also in this file it can be seen how each backend runs a program: https://github.com/effekt-lang/effekt/blob/master/effekt/jvm/src/main/scala/effekt/Runner.scala#L96)

For LLVM, I thought we had ported the io/args dependencies; however, it looks like it is still sitting in #223. @marzipankaiser can we just merge the PR?

b-studios commented 1 year ago

Sorry for the inconvenience @hflsmax , you could either locally merge the branch #223, copy file args.effekt (https://github.com/effekt-lang/effekt/pull/223/files#diff-ecb82a5b964a07ae0f30994a91f0f16a0eede8ea3f824761815597116af91135) or drop the import and hard code the parameters.

We will look into merging the branch ASAP on our side, to avoid this in the future.

hflsmax commented 1 year ago

Thanks. Just let you know that the branch can't be built out of the box and have merge conflicts with the master branch.

I'm closing this issue now as my initial questions are addressed. Thanks again.

b-studios commented 1 year ago

You're welcome. @marzipankaiser we should look into merging the PR #223 soonish, regardless.

@hflsmax just let us know if there is anything else.