Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions doc/lfsc1_5.g4
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ntype
// (^ c t)

// Extension /////////////////////
vtype : '(' 'var' iden ntype ')' ;
vtype : '(' 'id' iden ntype ')' ;
Comment thread
alex-ozdemir marked this conversation as resolved.
Outdated
//////////////////////////////////

type
Expand All @@ -89,7 +89,7 @@ type
| '(' '!' iden ntype type ')'
// Extension ///////////////////////////////
| '(' 'Forall' iden ntype type ')'
| '(' '->' ( ntype | vtype )+ type ')'
| '(' '->' '(' ( ntype | vtype )+ ')' type ')'

@alex-ozdemir alex-ozdemir Dec 9, 2020

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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.

////////////////////////////////////////////
;
// (Forall ξ τ₁ τ₂)
Expand Down Expand Up @@ -117,14 +117,14 @@ term
| rat_const
| '(' term term+ ')'
| '(' '\\' iden term ')'
| '(' '@' iden term ')'
| '(' '@' iden term term ')'

Copy link
Copy Markdown
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.

| '(' ':' 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
Copy Markdown
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.

;
//////////////////////////////////
// (lam ξ t)
Expand Down Expand Up @@ -167,4 +167,4 @@ code
INT : [0-9]+ ;
RAT : ('0' | [1-9][0-9]*) '/' [1-9][0-9]* ;
ID : [a-zA-Z~!@$%^&*_\-+=<>.?/][a-zA-Z0-9~!@$%^&*_\-+=<>.?/]* ;
KW : ':'[a-zA-Z0-9~!@$%^&*_\-+=<>.?/]* ;
KW : ':'[a-zA-Z0-9~!@$%^&*_\-+=<>.?/]* ;