-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement unary -
#17
Implement unary -
#17
Conversation
Thanks! Maybe should we add more test cases with nested operation to ensure the parse works correctly? run_simple_test("- -1.0", 1.0, 3);
run_simple_test("-(-hoge)", 2.0, 3); |
Thanks. Sure, I'll add some more test cases. |
It seems a function call like this is not handled properly, so my implementation is not correct. Let me think. -cos(0.0) |
Now parser emits ast for Now precedence of |
You are right, thanks. Should be fixed now! |
Currently, this code
cannot be parsed.
This is because there's no parser for unary operations. Currently, the lexer parses
-
as part of a float literal.mimium-rs/mimium-lang/src/compiler/parser/lexer.rs
Lines 24 to 30 in ee0ed1a
It might be a choice to require spaces before and after
-
to distinguish the binary op and the unary op. But, I think users expect this syntax is valid, so mimium anyway needs a unary parser.