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

Adjustments to new LFSC grammar. #53

Open
wants to merge 3 commits into
base: Version_1.5
Choose a base branch
from

Conversation

alex-ozdemir
Copy link
Member

I've implemented a version of the new LFSC syntax. Based on my implementation, I'm recommending a few changes to the grammar (rationales in comments).

Once we agree on what the grammar is, I'll port the changes to the C++ LFSC implementation.

doc/lfsc1_5.g4 Outdated Show resolved Hide resolved
doc/lfsc1_5.g4 Outdated
@@ -89,7 +89,7 @@ type
| '(' '!' iden ntype type ')'
// Extension ///////////////////////////////
| '(' 'Forall' iden ntype type ')'
| '(' '->' ( ntype | vtype )+ type ')'
| '(' '->' '(' ( ntype | vtype )+ ')' type ')'
Copy link
Member Author

@alex-ozdemir alex-ozdemir Dec 9, 2020

Choose a reason for hiding this comment

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

Surrounding the argument list in parentheses makes it clear when we are done with arguments.
This makes it easier to type-check the return type without constructing an AST for it. Without the parentheses it would be hard to avoid constructing the AST for the return type, since we wouldn't know it isn't an argument (which we would need an AST for!) until we're done processing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, this makes -> more like declare-rule and declare-type.

@@ -117,14 +117,14 @@ term
| rat_const
| '(' term term+ ')'
| '(' '\\' iden term ')'
| '(' '@' iden term ')'
| '(' '@' iden term term ')'
Copy link
Member Author

Choose a reason for hiding this comment

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

I think was just a typo.

doc/lfsc1_5.g4 Outdated
| '(' ':' type term ')'
| '(' '%' iden type term ')'
// Extensions ///////////////////
| '(' 'lam' iden term ')'
| '(' 'let' iden term term ')'
| '(' 'proved-by' type term ')'
| '(' 'assuming' vtype+ term ')'
| '(' 'assuming' '(' (ntype | vtype)+ ')' term ')'
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding parentheses is a good idea here, just like for the -> form.
It's even more important in this case, because most of the proof will likely be in the final term here, so we really don't want to construct the AST for it.

* (: instead of (id in declaration lists
* check-assuming
* define-const
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants