https://github.com/purefunctor/corefn
CoreFn is an extensible JSON-based representation for functional languages based on lambda calculus.
https://github.com/purefunctor/corefn
Last synced: 4 months ago
JSON representation
CoreFn is an extensible JSON-based representation for functional languages based on lambda calculus.
- Host: GitHub
- URL: https://github.com/purefunctor/corefn
- Owner: purefunctor
- License: bsd-3-clause
- Created: 2021-10-19T18:39:55.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-19T18:40:05.000Z (almost 5 years ago)
- Last Synced: 2025-06-05T23:06:00.637Z (about 1 year ago)
- Language: Dhall
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
* CoreFn
CoreFn is a minimal, extensible, malleable, JSON-based representation for functional languages based on
lambda calculus. It aims to provide the following use-cases:
+ An optimizing intermediate representation that can generate code for various high-level targets
like Node.js or Scheme.
+ An easy-to-use representation for implementing language tools like documentation generators or
rich REPL environments.
* Questions
I can't name this section "Frequently Asked Questions" yet because there's no such questions, but
here's some that might come up:
** CoreFn as in PureScript's CoreFn?
This project is inspired primarily by [[https://github.com/purescript/purescript][PureScript]]'s internal ~CoreFn~ representation which allows
different backends to be implemented fairly easily. However, this project only aims to provide a
frontend for the representation and its targets, not a full-blown compiler suite.
** High-Level Targets?
Given that CoreFn is essentially lambda-calculus-in-JSON, the easiest languages to target would be
those that are heavily expression-based like modern JavaScript, various LISP flavors, or Erlang.
** Module System?
CoreFn aims to provide a target-agnostic module system that avoids problems such as dependency
cycles between modules. CoreFn files are considered as distinct modules, and they can refer to other
CoreFn files to signify imports.
** Why PureScript?
I decided to implement CoreFn in PureScript particularly because of its simplicity and the fact that
it compiles to JavaScript, which is practically portable in all platforms. However, I also encourage
implementing CoreFn in other languages for reasons such as performance or just language support.
** Stability?
There's no guarantee that the canonical implementation (i.e. this project) will be stable in the
near future, as this is a hobby project. However, once it grows to a reasonable size, I'll start
diverting more focus to the project to hopefully pick up adoption.