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

Cast expressions #48

Closed
brendanzab opened this issue Nov 27, 2017 · 0 comments
Closed

Cast expressions #48

brendanzab opened this issue Nov 27, 2017 · 0 comments
Projects

Comments

@brendanzab
Copy link
Member

brendanzab commented Nov 27, 2017

Host expressions should have include a cast expression to allow for explicit casts between numeric types. These should be in the form:

host-expr ::=
    ...
    host-expr "as" host-type

Example:

struct {
    width: u32le,
    height: u8,
    data: [u8; width * height as u32],
}
  • Parsing: Note that the challenge is that cast expressions require that we be able to also parse host types, rather than just binary types. We could start off hard-coding the base types to avoid issues regarding variable capture and environments.
  • Type checking: We'll have to check that the input and output types are numeric
  • Lowering to IR: We'll need to add another variant to the Expr type
  • Lowering to Rust: This should be relatively simple - just use as in Rust. Might be harder to maintain consistent semantics across other languages though. 🤔
@brendanzab brendanzab added this to Ready in Development Nov 27, 2017
@brendanzab brendanzab moved this from Ready to In Progress in Development Nov 27, 2017
@brendanzab brendanzab moved this from In Progress to Ready in Development Nov 27, 2017
@brendanzab brendanzab moved this from Ready to In Progress in Development Nov 28, 2017
brendanzab added a commit that referenced this issue Nov 28, 2017
brendanzab added a commit that referenced this issue Nov 28, 2017
brendanzab added a commit that referenced this issue Nov 28, 2017
Development automation moved this from In Progress to Done Nov 28, 2017
brendanzab added a commit that referenced this issue May 1, 2018
Use nameless::Ignore in syntax trees
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development
  
Done
Development

No branches or pull requests

1 participant