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

[Enhauncement] Added 'for' loops #26

Merged
merged 1 commit into from
Sep 13, 2019
Merged

Conversation

effectfully
Copy link
Owner

This adds the type of statements to the language (currently a statement is either a let-definition or an assertion) and for loops that get unrolled during parsing into lists of statements.

I also refactored the parser a bit.

withGeqBinOp Div Div y _ = y
withGeqBinOp _ _ _ z = z
withGeqUni :: Uni f a1 -> Uni f a2 -> b -> (a1 ~ a2 => b) -> b
withGeqUni Bool Bool _ y = y
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old order was less convenient.

, case knownUni @f @a of
Bool -> neq0Expr <|> eqExpr
Field -> empty
]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have a single expr1 and can share some code, which is convenient.

, EAppBinOp FLt l <$> (symbol "<" *> exprPoly)
, EAppBinOp FGe l <$> (symbol ">=" *> exprPoly)
, EAppBinOp FGt l <$> (symbol ">" *> exprPoly)
]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a TODO above about optimizing comparisonExpr. This fixes the TODO.

, " end;"
, "end;"
, "p"
]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example.

@effectfully effectfully force-pushed the enhancement/added-for-loops branch from 7f24f75 to f1cc915 Compare September 13, 2019 11:26
@effectfully
Copy link
Owner Author

I'll merge right away, because I need this downstream, but please @kwxm review the PR anyway, I'll address your comments in a future PR.

@effectfully effectfully merged commit 5a0ed41 into master Sep 13, 2019
@effectfully effectfully deleted the enhancement/added-for-loops branch September 13, 2019 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant