Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future work on interpreter #1194

Open
brprice opened this issue Nov 30, 2023 · 0 comments
Open

Future work on interpreter #1194

brprice opened this issue Nov 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@brprice
Copy link
Contributor

brprice commented Nov 30, 2023

Description

There is some future work we could do on the new interpreter #1187. This (WIP) FR is to record some ideas.

Dependencies

None

Spec

We rely heavily on laziness and the Haskell runtime, and we work entirely in the Expr AST. This means we cannot make expressions spine-strict with our current interpreter. One reason we made this choice was an attempt to be able to return a sensible result if we time-out (this hope did not pan out). Since the implementation choice requires us to evaluate under lambdas, and we don't actually want to do that all the time (e.g. if a student asks to evaluate the function map for instance, we don't want to unroll recursive occurrences), it may pay off to change strategy.

We could investigate a more traditional interpreter or compile-to-closures, representing the interpretation of a (syntactic) lambda as a Haskell lambda or a closure (pair of environment and syntactic body). Another approach of interest is normalization by evaluation. Perhaps a smaller change to enable a sensible partial result after a timeout would be to investigate a CPS style.

Implementation details

Unknown as yet, but we should think about whether (and how) the implemented strategy will evaluate under lambdas, and whether it can sensibly have a deterministic (non time-based) timeout (and if so whether it can return partially evaluated results). Another decision needed is whether to require exact agreement with the small-step reduction semantics (NBE returns eta-long results, which small-step may not).

Not in spec

Discussion

Future work

This may unlock making the Expr type stricter.

@brprice brprice added enhancement New feature or request triage This issue needs triage labels Nov 30, 2023
@dhess dhess removed the triage This issue needs triage label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants