Lexa is a programming language supporting lexically scoped effect handlers. These effect handlers are a powerful means to express and manage complex control flow. They allow for strong local-reasoning principles, too.
This repository contains an implementation of Lexa. The compiler translates high-level, modular algebraic effects to low-level, swift stack switching. The design and implementation of the Lexa compiler are described in the following paper:
Cong Ma, Zhaoyi Ge, Edward Lee, Yizhou Zhang.
Lexical Effect Handlers, Directly.
Proceedings of the ACM on Programming Languages (PACMPL), Volume 8, Issue OOPSLA2, October 2024.
- Supported platform: x86-64.
- 32GB of RAM recommended for building.
docker run -it hflsmax/lexa-lang:OOPSLA24
- Install Nix: Follow the instructions to install Nix on your system.
- Clone the repository: Clone the Lexa repo to your local machine.
- Build the development environment: Run
nix develop
in the repository root. This could take over an hour. - Build the project: Run
dune build
to build the compiler.
To run the Lexa compiler, use the following commands:
./lexa <source_file>
./a.out
See ./casestudies
and ./test
for exmaple Lexa programs.
- Follow the instructions above to set up the project.
- Figure 2: Run
cd scripts; python ./plots.py --tick-plot --plot-only ./final_plotting_runtimes2.csv
. The plot will be saved in./scaling_plots/two_scaling_plot.pdf
. To plot using fresh data, runpython ./plots.py --tick-plot
. - Table 1: Run
cd scripts; python bench.py
. The result will be saved in./runtimes.csv
. - Figure 16: Run
cd scripts; python ./plots.py --plot-only ./final_plotting_runtimes.csv
. The plot will be saved in./scaling_plots/scaling_plot.pdf
. To plot using fresh data, runpython ./plots.py
. - Test formalized translation: Run
cd src/formalized_translation; racket artifact.rkt
.
Please reach out to Cong Ma ([email protected]) for any questions. We welcome contributions to the project.