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

Support slicing an expression #32

Merged
merged 2 commits into from
Jan 9, 2020
Merged

Support slicing an expression #32

merged 2 commits into from
Jan 9, 2020

Conversation

leonardt
Copy link
Owner

@leonardt leonardt commented Jan 6, 2020

This enhances the slice node to take an arbitrary expression (rather than just a simple identifier), for now it defaults to wrapping the expression in parens except for simple cases.

@rsetaluri
Copy link
Collaborator

Looks good, but question: can all expressions be sliced? Not familiar with formal AST spec and what all an expression can be.

@leonardt
Copy link
Owner Author

leonardt commented Jan 7, 2020

I think that would be a type checker issue, e.g. generally an expression of the from (...)[4:0] would be valid syntactically, but depending on the contents of (...) it may or may not be a valid program. For our purposes, I think it greatly simplifies things to just support any expression, and require that the code generator generate a valid expression (this is easier than requiring than any arbitrary input user code is valid, since the coreir compiler generates rather simple legal expressions).

@rsetaluri
Copy link
Collaborator

Ok, that makes sense to me (respecting the syntactic validity but type checker would do the rest)

@leonardt leonardt merged commit 796643b into master Jan 9, 2020
@leonardt leonardt deleted the slice-expr branch January 9, 2020 00:17
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.

None yet

2 participants