Git Product home page Git Product logo

dhall-clj's People

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  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  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  avatar  avatar  avatar  avatar  avatar

dhall-clj's Issues

Preserve source information as metadata

To preserve source information, the Haskell implementation uses a Note constructor as a wrapper.

We get this data already from Instaparse as metadata, so we should just pass this metadata around.
This would probably mean be careful about creating new objects (because they should carry the meta from the old ones) or even just applying non-meta-aware functions to them.

Compiler implementation plan

The goal for the project is to provide Dhall bindings to/from Clojure. The original plan was to get an MVP working ASAP, with the following steps:

  • grab the ABNF and get a free parser for it
  • run the reference implementation on Eta, and use it for resolving imports + typechecking + normalizing (Haskell source -> running on Eta -> make Java bindings -> call from Clojure), so that we have to only do the last mile of transforming the evaluated form to a clojure s-exp.

However, this "shortcut" is not viable yet, so it probably makes more sense to just implement the compiler from the get go, to also have another complete implementation of the standard (at the time of writing only the reference Haskell implementation is complete).

A plan for the Dhall compiler implementation is detailed in dhall-lang/dhall-lang#11, and some more info is in the semantics document and the reference implementation.

Checklist for the compiler implementation:

  • Parse Dhall code into a Parse Tree
  • Transform Parse Tree into Expression Tree
  • Resolve imports:
    • Parse into AST
    • Get envvars (with System/getenv)
    • Get local files (with slurp)
    • Get URLs (also with slurp? How about headers? Maybe we have to bring in clj-http) EDIT: now tracked in #7
    • Be careful that imports need to be cached and retrieved once and only once.
    • Also we'll need to perform the semantic integrity checks (basically sha256 on imports). This is not standardized yet, so it's fine if we ignore them for now. EDIT: now tracked in #5
    • After all of this is done, the "security concerns" document should be implemented. EDIT: also tracked in #7
  • Typecheck
    • shift
    • subst
    • typecheck
  • Normalize
    • alpha-normalize
    • beta-normalize
  • Simple tests
    • Parse
    • shift
    • subst
    • alpha-normalize
    • beta-normalize
    • typecheck
    • import EDIT: tracked in #9
  • Tests from the Haskell implementation
    • Parse EDIT: tracked in #10
    • Typecheck
    • Normalize
    • Imports EDIT: tracked in #9
  • emit Clojure s-exps from the Expression Tree

Perform semantic integrity checks

We should perform the semantic integrity checks on imports (right now they are skipped)

Blocked by #4 (as we should hash the binary-encoded blob)

Support accessing shadowed variables

The following expression is broken in our interpreter:

λ(x : Bool)  λ(x : Bool)  x@1

since it emits the following form:

(clojure.core/fn [x] (clojure.core/fn [x] x-1))

which doesn't make any sense.

The problem here is that Clojure does not support accessing shadowed bindings, so to fix this we should rename all variables to something unique; the sanest option is to use the De Bruijn indices for it e.g. x@0 -> x_0.
In this way we can solve this by just applying α-normalization parametrized by the rename variable (instead of _)

See dhall-lang/dhall-haskell#596

Add CI

Most likely with GitlabCI. It should run tests only on master for now.

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.