-
Notifications
You must be signed in to change notification settings - Fork 0
Description
A variety of operators are missing support the parser, hir, and/or codegen. For example, negative integers aren't allowed (passes the lexer, but -(expression) is rejected by the parser). Similarly, bitwise logic, shifting, unary bitwise negation, and boolean logic. We should more generally do a pass over all stages of the compiler pipeline and test that everything is working everywhere (write a sample program that tests everything).
Reminder that boolean logic requires short-circuit logic. That is, when emitting a boolean and, the following is incorrect:
- emit left operand
- emit right operand
- emit left && right
Instead, do the following: - alloca bool
- emit left operand
- if (!left) bool = false
- emit right operand
- bool &= right
Similar for or. Whether to do this in HIR or have a special hir instruction and emit this in codegen is up to the author's discretion. It would be nice to not have an alloca, and instead use branch expressions in HIR/phi in llvm. If this ends up being difficult, its not the end of the world since opt's mem2reg pass will probably clean it up.