Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Define an AST with no currying semantics and translate to it #25

Merged
merged 5 commits into from
Nov 22, 2019

Conversation

vaivaswatha
Copy link
Contributor

@vaivaswatha vaivaswatha commented Nov 21, 2019

PR #23 did a poor attempt at doing the same thing, without redefining Scilla's typ to accommodate functions with multiple arguments. This PR does it all neatly.

This PR defines an AST with the following differences with Scilla's AST:

FunType of typ * typ is now defined as FunType of (typ list) * typ and the expression Fun of ident * typ * expr is defined as Fun (ident * typ) list * expr . The definition of App remains same, except that its semantics is no more that of currying. So the translation pass splits existing App into a sequence of Apps. For example y = f a b (in the original Scilla semantics) now becomes x = f a; y = x b

In the future, we can easily do a decurrying optimization on this new AST to optimize function calls (see #24) .

@vaivaswatha
Copy link
Contributor Author

@jjcnn , the code change is quite huge, but most of it is mundane adaptations of functions from TypeUtilities and Datatypes.

The key items to review are: (1) typ and expr definition in UncurriedSyntax.ml and the translation of Fun and App in Uncurry.ml.

src/lang/codegen/Uncurry.ml Show resolved Hide resolved
src/lang/codegen/Uncurry.ml Show resolved Hide resolved
src/lang/codegen/Uncurry.ml Show resolved Hide resolved
@vaivaswatha
Copy link
Contributor Author

Thank you @jjcnn

@vaivaswatha vaivaswatha merged commit 7ac3fe8 into master Nov 22, 2019
@vaivaswatha vaivaswatha deleted the uncurry branch November 22, 2019 12:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants