Git Product home page Git Product logo

Comments (8)

f-f avatar f-f commented on August 18, 2024

@Gabriel439 is the above somehow accurate? Am I missing any steps?

from dhall-clj.

Gabriella439 avatar Gabriella439 commented on August 18, 2024

The only steps missing are the ones not yet standardized (specifically semantic integrity checks). Other than that it looks complete to me

from dhall-clj.

f-f avatar f-f commented on August 18, 2024

Cool thanks! I didn't consider the semantic integrity checks, added to the list.

from dhall-clj.

f-f avatar f-f commented on August 18, 2024

Update: as of 878023f, we now parse all Dhall forms (except imports) from text into an Expr tree.
The Expr type itself is copied straight from the haskell implementation (ours is here).

Basically parsing happens like so:

  • we generate a parser from the abnf with Instaparse
  • run that on input
  • convert the resulting "parse tree" to the Expr AST (code is here)

We have ~50 testcases for basic parsing here - we check that a parsed text form generates a certain AST.

from dhall-clj.

f-f avatar f-f commented on August 18, 2024

As of what to do next, I was thinking about skipping the imports for now (as some things like "semantic integrity checks" are not standard yet) and work on typechecking/normalizing/emit the "pure" subset of Dhall (so that the pipeline is in place and works).

from dhall-clj.

f-f avatar f-f commented on August 18, 2024

@Gabriel439 I'm implementing beta-normalize for function application, and I was wondering about your implementation of NaturalFold: do I have to differentiate between a strict unrolling and a lazy one or can I just use a single folding strategy? Is it like that for performance reasons?

from dhall-clj.

Gabriella439 avatar Gabriella439 commented on August 18, 2024

@f-f: It's purely an optimization and not required by the standard so if you want to do the single folding strategy that is definitely allowed.

Basically the standard allows you to do anything you want as long as the final result is the same. For example, Natural/even/Natural/odd would be very slow if you pedantically followed the reference implementation in the standard.

See: https://github.com/dhall-lang/dhall-lang/blob/master/standard/semantics.md#%CE%B2-normalization

Also, note that the semantics specifies several built-in types, functions and operators that conforming implementations must support. Implementations are encouraged to implement the following functions and operators in more efficient ways than the following reduction rules so long as the result of normalization is the same.

from dhall-clj.

f-f avatar f-f commented on August 18, 2024

@Gabriel439 cool, thanks.
As you said naively implementing the specification would be inefficient, so I figured the best path forward was to port your implementation (e.g. the even/odd stuff, or the build/fold fusion) but try to omit the small details (e.g. I don't need this lazy/strict differentiation yet, I'll set up profiling/benchmarks before trying to optimise anything).

I'll also reuse your tests for type check/normalisation/etc (and I guess it would be nice move them to the dhall-lang repo at some point, so they can be in sync with the spec)

from dhall-clj.

Related Issues (20)

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.