Skip to content

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.

@leonardt leonardt requested a review from rsetaluri January 6, 2020 23:56
@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.

2 participants