-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Refactor Expression
and TypeExpression
#960
Comments
There are some ideas.
module ModuleA {
inst u: ModuleB #(
p: type logic,
);
const X: type = logic; // simple, but not consistent
const Y: type = type logic; // consistent and redundant
const Z: type = type type(a); // type operator should be considered too
} |
I think 2 is a simple and good solution, but I don't really want to write |
This is a limitation of Parol, yes? Is there no way to force it to parse an ambiguous grammar, and then make the correct choice between TypeExpression vs Expression given additional context collected by the Veryl compiler? |
Instead of adding
If so, type parameter override and |
Yes. This is because Parol is LL(k) parser, but this is intentional decision. I think choosing |
Instead of introducing inst u: ModuleB #(
p: <logic>,
);
const X: type = <logic <32>>; |
I like your idea, taichi. I think maybe also the |
Especially I like |
Unfortunatly, inst u: ModuleB #(
p: [logic<32>],
);
inst u: ModuleB #(
p: :logic<32>,
);
const X: type = [logic<32>];
const X: type = :logic<32>; |
I like |
My concern about |
I'm thinking merging Expression and TypeExpression may be reasonable.
The above ambiguous does not actually occur because packed-array is So the followng syntax can merge TypeExpression into Expression.
In the above syntax, |
Now type parameter overriding by built-in types is syntax error.
This is because
InstParameterItem
can takeExpression
only.If we simply add
TypeExpression
to it, syntax ambiguous occurs because bothExpression
andTypeExpression
can reachScopedIdentifier
.So I think this case requires to refactor whole
Expression
andTypeExpression
.Refer: #958
The text was updated successfully, but these errors were encountered: