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

Add type inference capabilities to AST #455

Open
Tracked by #457
UnsignedByte opened this issue Sep 9, 2024 · 0 comments
Open
Tracked by #457

Add type inference capabilities to AST #455

UnsignedByte opened this issue Sep 9, 2024 · 0 comments

Comments

@UnsignedByte
Copy link
Collaborator

This is a purely front-end proposal for possibly adding type inference to Filament. This would allow the user to write programs without directly specifying their timing, Initially, we can just eliminate the requirement for providing events.

add1 := Add[W](in0, in1);
add2 := Add[W](add1.out, add1.out);

This should be relatively simple to implement, but does have a few interesting questions on the backend side.

  1. Instances and Invocations?
    • I think the best way to go here is to allow instances and invocations just the same. This means however that if the user invokes a component twice, the compiler would still have to infer a non-intersecting timing for reuse.
    • Another idea is to allow the compiler to infer reuse, which we could do using a component level attribute flag. In this case, we might turn every invocation into an instantiation, or instead only allow the compiler to combine instantiations, not create new ones.
  2. Partially type inferenced components
    • This representation allows for some invocations to be type inferenced, while others can still be explicitly described. Not sure how this feature would be useful, but we could use these explicit invocations to further constrain the compiler.
  3. Enable/Disable?
    • For safety, I think it would be nice to maybe have an attribute like type_inference or something that needs to be set, so that the user has to explicitly ask for this feature. Not sure if this is necessary though.

As this is simply a frontend proposal, we can implement it for now and simply have the compiler throw an error when the the user attempts to use it.

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

No branches or pull requests

1 participant