It has absolutly nothing to do with cars or wind's and it's also not fast actually it's a blessing that the compiler even compiles. Inspired by Buzz
In favor of a better and more stable IR I decided to put this project on ice until I built a more stable and better IR. After that the IR system will be completely rewritten.
- Add alignment to IR
- Split globals and global constants in module
- Prevent values and enforce types for extern variables
- Remove global from IRValue
- Better error messages please
-
Create snippets for error=> string formating is **** - Bug: You can create void variables implicitly through a function which returns void
- Constants
- Different linkages
- Separate Variable and Function checks from type inference
- Check if function returns if not void
- Complain when function return value is not used
- Remove unnecessary external enum for expressions
- Add function call as Statement
- Check function call fits signature
-
SSA not correctly implemented=> optimization required - Using function parameters results in segmentation fault
- Leaving the ending brace of a function results in memory leaks and multiple parser errors
- X-Assigns result in weird IR and memory leak
- Errors for IRGen
- Add function body
- Create Statment tagged union
- Parse parameters
- Add void type
- Add checking for void type
- [~] Variable shadowing => Implicitly works didn't specifically implement it
- Return statement
- Assign to already declared variable
- Illegal assignment on undeclared variable
- Fix case where position is 0 because body is empty
-
Costexpr doesn't really allow implicit floats anymore=> is actually expected behaviour - Fix constant expr on division =>
2 * 5 + 2 * 3 / 2 = 12
truncation happens too early
actual result: 13
Binary expressions in global scope with different types. IT WILL TRIGGER THE INCORRECT MATH GODSFixed somewhat but I wouldn't trust my self with this.
Wroom:
let glbl = 123
func main(argc: int) int {
let locl = 123 * 2 + 1 * glbl
return locl
}
IR:
@glbl i32 = #123
@main(i32 argc) -> i32 {
entry:
%0 = alloca i32
%1 = mul i32 #123, #2
%2 = load i32, @glbl
%3 = mul i32 #1, %2
%4 = add i32 %1, %3
store i32 %0, %4
%5 = load i32, %0
return %5
}Wroom:
func multiply(a: int) int {
return 2 * a
}
func main() int {
let wtf = multiply(69420)
return wtf
}
IR:
@multiply(a i32) -> i32 {
entry:
%0 = load i32, @a
%1 = mul i32 #2, %0
return %1
}
@main() -> i32 {
entry:
%0 = alloca i32
%1 = call @multiply(#69420)
store i32 %0, %1
%2 = load i32, %0
return %2
}