3 ms·
Pretty sure your parser would need unbounded lookahead to support this syntax.
by gnuvince 13y ago
Pretty sure your parser would need unbounded lookahead to support this syntax.
- acqq 13y agoWhat do you think how the parser parses anything on the left side, e.g. in C: *( arraybase + f1( d ) * f2( e, f ) + f3( g ) ) = x;
- pcwalton 13y agoThe issue is that "expression" is the same nonterminal in C, whereas "expression" and "pattern" are separate nonterminals.
- acqq 13y agoIn C a difference still exists between a lvalue and a rvalue. Even if you can unify something at one level, you have to generate completely different code. C++ is even harder. So I can imagine something can be done when there would be an intention, probably something would have to be a bit more unified. But I guess nobody even tried. BTW, I really like the basic goals of Rust, namely making something directly linkable with C but having as much as possible safety and more modern features. And I appreciate the work of the developers of Rust. Even introductory materials would benefit by promoting what we can do that wasn't as safe to be done in C.