-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ISLE: improve syntax BNF #9903
ISLE: improve syntax BNF #9903
Conversation
@@ -1442,12 +1442,14 @@ The grammar accepted by the parser is as follows: | |||
| "\t" | |||
| "\n" | |||
| "\r" | |||
| "\b" | |||
| "\f" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sake of completeness. I suppose they're also ignored by the parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no -- the full list of whitespace characters is here. The original list was correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have double checked first, sorry about that.
@@ -1458,45 +1460,43 @@ The grammar accepted by the parser is as follows: | |||
<ISLE> ::= <def>* | |||
|
|||
<def> ::= "(" "pragma" <pragma> ")" | |||
| "(" "type" <typedecl> ")" | |||
| "(" "type" <type> ")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just use the dumbest mapping :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, there is a reason I had chosen typedecl
-- type
is too close to ty
(the latter reads as an abbreviation of the former with no semantic difference), the existing nonterminal for type expressions, and there is a semantic difference between uses of a type and the form that declares them. Let's stick with typedecl
.
<pragma> ::= <ident> | ||
|
||
<typedecl> ::= <ident> [ "extern" | "nodebug" ] <typevalue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically not a value, could be confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, here I would disagree again. You can call it a "type expression" if you want, but it's a value in the universe of types. It is definitely not a typedef
: typedef
is, in my mind, another name for the whole form that defines a new type (like a typedef in C/C++ for example). Perhaps "type body" if you want to distinguish the semantic place this occupies -- an expanded form that can be named in a type
declaration form's right-hand side but not in-line wherever types are given.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, typedef is worse than typevalue.. I did mean something like "type body". How about
<typedef> ::= <ident> [ "extern" | "nodebug" ] <type-body>
to set it apart from <decl>
?
|
||
<enumvariant> ::= <ident> | ||
| "(" <ident> <enumfield>* ")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically it's a field of the variant
@@ -1508,7 +1508,7 @@ The grammar accepted by the parser is as follows: | |||
| "(" <ident> <pattern-arg>* ")" | |||
|
|||
<pattern-arg> ::= <pattern> | |||
| "<" <expr> ;; in-argument to an extractor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be very wrong about this. But having this kind of infix operator defined in S-expression feels weird and I couldn't find it in the extractor parser, so I think this is a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is outdated syntax, sorry -- we removed argument polarity a while ago. The whole <expr>
case needs to go away and you can inline <pattern>
for <pattern-arg>
since we don't have the distinction anymore.
Subscribe to Label Action
This issue or pull request has been labeled: "cranelift", "isle"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Unfortunately this introduces some inaccuracies and I have a lot of comments -- see below.
@@ -1442,12 +1442,14 @@ The grammar accepted by the parser is as follows: | |||
| "\t" | |||
| "\n" | |||
| "\r" | |||
| "\b" | |||
| "\f" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no -- the full list of whitespace characters is here. The original list was correct.
@@ -1458,45 +1460,43 @@ The grammar accepted by the parser is as follows: | |||
<ISLE> ::= <def>* | |||
|
|||
<def> ::= "(" "pragma" <pragma> ")" | |||
| "(" "type" <typedecl> ")" | |||
| "(" "type" <type> ")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, there is a reason I had chosen typedecl
-- type
is too close to ty
(the latter reads as an abbreviation of the former with no semantic difference), the existing nonterminal for type expressions, and there is a semantic difference between uses of a type and the form that declares them. Let's stick with typedecl
.
<pragma> ::= <ident> | ||
|
||
<typedecl> ::= <ident> [ "extern" | "nodebug" ] <typevalue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, here I would disagree again. You can call it a "type expression" if you want, but it's a value in the universe of types. It is definitely not a typedef
: typedef
is, in my mind, another name for the whole form that defines a new type (like a typedef in C/C++ for example). Perhaps "type body" if you want to distinguish the semantic place this occupies -- an expanded form that can be named in a type
declaration form's right-hand side but not in-line wherever types are given.
@@ -1508,7 +1508,7 @@ The grammar accepted by the parser is as follows: | |||
| "(" <ident> <pattern-arg>* ")" | |||
|
|||
<pattern-arg> ::= <pattern> | |||
| "<" <expr> ;; in-argument to an extractor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is outdated syntax, sorry -- we removed argument polarity a while ago. The whole <expr>
case needs to go away and you can inline <pattern>
for <pattern-arg>
since we don't have the distinction anymore.
Out of curiosity, is there a reason for |
Locally it made sense as "convert T to U using foo"; one could debate the many options further but we already had that discussion three(?) years ago and it's unlikely to change now absent good reason. |
<pattern-arg>
syntax(?)