Giter Site home page Giter Site logo

agda2scheme's People

Contributors

jespercockx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

agda2scheme's Issues

Add support for imports

In order to make the backend practically useable, it needs to have support for imports from other files.

One choice that needs to be made is whether we compile each Agda file to a separate Scheme file, or if we join all files together into a single master file. Since Chez Scheme does not do cross-module optimizations, the latter would have better performance, but it would mean we give up on separate compilation.

Support more built-in types

The following built-in types of Agda are not yet supported:

  • Integers
  • Floats
  • Chars
  • Strings
  • Word64

Note that by default, Scheme uses complex numbers, so we need to use the flo-prefixed versions of operations on floats.

Add support for main function

Currently Agda2Scheme compiles Agda definitions to Scheme definitions, but there is no way yet to indicate a main function.

One question here is whether we want something like the IO monad in Haskell to mediate basic input/output effects, or if we just use a more direct style of doing IO.

Don't store constructor tag for records and single-constructor datatypes

Currently constructors always store a tag, even when there is only a single option.

As a stretch goal, we could even skip the constructor tag if there are several constructors, as long as there is only a single constructor of each given arity. We can then just determine which constructor we have by looking at the length of the argument list.

Add a benchmarking suite

Here is how I am running my benchmarks so far:

cd test
agda2scheme --lazy Triples.agda
echo '(display (test1)) (display "\n")' >> Triples.ss
echo '(compile-file "Triples.ss")' | chezscheme -q
time chezscheme --script Triples.so

It would definitely be good to automate this.

Adding CI using Github Actions?

Hello,
Thank you for creating this repository. I am studying this to learn how to write backend in Agda!

I play around with adding CI support to this on my fork here lemastero#1, would it make sense to open such PR towards this repository?

Compile nat-like and int-like types to integers

It would be cool if we could detect automatically types that are sufficiently like natural numbers or integers, and represent them using actual integers in the compiled code. As a stretch goal, we could even try to detect that certain functions are just addition/subtraction/... and compile them to more efficient versions as well.

Don't use lazy thunks for arguments that are always used

Currently compiling code with the --lazy flag incurs a quite heavy performance overhead (e.g. the slowdown is over 10x on Triples.agda). If we could analyze which arguments are always used by a given function, then we could avoid creating delay thunks for those arguments and instead evaluate them strictly. I started implementing this analysis in 2834874, but it is not yet clear to me how to do this analysis properly for mutually recursive functions.

Use arrays instead of lists to represent constructors

Arrays give constant-time access to their elements so they might be more efficient, especially for record types with many fields.

We could also consider using arrays to represent argument lists for functions with a high arity.

Automate unit tests

Hello,
In test directory there are golden tests, but there is no code that actually illustrate how to run them.
Since this repo works as example how to build backend, it would be nice to have unit tests encoded in Haskell.

Add support for foreign functions

In order to support custom primitives for doing IO and such, it would be good to support FOREIGN pragmas to include snippets of Scheme code into the Agda source.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.