Skip to content
Merged

L2 #3

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
07cff6b
feat: implement various instructions, IR and parsing elements
Entenwilli Jun 2, 2025
d5170b1
feat(ir): implement new more flexible ir
Entenwilli Jun 10, 2025
81f019b
feat(ir): implement IR for if expressions
Entenwilli Jun 11, 2025
e81d427
feat(ir/codegen): finally implement while
Entenwilli Jun 14, 2025
c3484ca
fix(parsing): fix missing check/fail for missing semicolon
Entenwilli Jun 14, 2025
3d9edbf
feat(ir/codegen): implement for
Entenwilli Jun 14, 2025
e836bd3
feat(codegen): implement missing comparison operators
Entenwilli Jun 14, 2025
cad8fb7
fix(phi): fixes for reading/writing with phis
Entenwilli Jun 14, 2025
7fab231
fix(codegen): fix missing newlines for shift operations
Entenwilli Jun 14, 2025
bc51776
fix(codegen): fix assembly for shift operations
Entenwilli Jun 14, 2025
c1bd5a9
fix: fix expecting only int types
Entenwilli Jun 15, 2025
c8a1a34
fix(phi): finally understand when which phi should be moved to
Entenwilli Jun 15, 2025
06a7a79
fix(ir): fix missing inverted operators
Entenwilli Jun 15, 2025
8285a56
feat(semantic): add type checking
Entenwilli Jun 15, 2025
ecdd765
fix(parsing): use correct type for statement
Entenwilli Jun 15, 2025
dd5c600
fix(semantic): check type of return value
Entenwilli Jun 15, 2025
103e24b
fix(ir): fix logical and bitwise not
Entenwilli Jun 15, 2025
280f805
feat: 32 bit assembly fixes
Entenwilli Jun 15, 2025
c3c2fc8
fix(ir): fix phi operands for ternary operator
Entenwilli Jun 15, 2025
09ea149
fix(codegen): skip projections when moving phis
Entenwilli Jun 15, 2025
f125084
fix(semantic): add shift left and shift right to type operators
Entenwilli Jun 15, 2025
3fb2781
fix(ir): fix break and continue statements
Entenwilli Jun 15, 2025
8423648
fix(ir): some more loop fixes
Entenwilli Jun 16, 2025
fc297e2
fix(semantic): enable type checking for comparison operators
Entenwilli Jun 16, 2025
243ad12
fix(while): fixes for continue
Entenwilli Jun 16, 2025
d5af8d3
feat(main): change levels to debug to see differences in compilations
Entenwilli Jun 16, 2025
efc208a
fix(ir): fix generation of conditional jumps
Entenwilli Jun 16, 2025
e22e0f2
feat(semantic): add return analysis for ifs
Entenwilli Jun 16, 2025
64b7f54
feat(ir): recursive generation of some jump conditions
Entenwilli Jun 16, 2025
bf6365b
feat(ir): recursive generation of boolean conditions
Entenwilli Jun 16, 2025
b82e8a4
fix(ir): fix boolean conditional jump generation
Entenwilli Jun 16, 2025
0d37aa9
fix(semantic): returns in for and while should be ignored for return …
Entenwilli Jun 16, 2025
28a160d
fix(semantic): do not count definitions in for postcondition
Entenwilli Jun 16, 2025
8a6cedb
fix(semantic): do not reset returning state for loops if function ret…
Entenwilli Jun 16, 2025
00c31a4
fix(semantic): fixing more namespace issues
Entenwilli Jun 16, 2025
101f22b
fix(ir): fix referencing for entry points loops and nesting
Entenwilli Jun 16, 2025
fa4e2fc
fix(semantic): namespace fixes for if
Entenwilli Jun 16, 2025
062f507
fix(semantic): enforce types for assignment operators
Entenwilli Jun 16, 2025
c4f6ed9
feat(codegen): implement XOR
Entenwilli Jun 16, 2025
3cb75dd
feat(ir): implement missing assignment operators
Entenwilli Jun 16, 2025
19c61c7
fix(semantic): fix order of assignment initialization checking
Entenwilli Jun 16, 2025
eea1bcc
fix(semantics): blocks do not have innate scoping
Entenwilli Jun 16, 2025
1de6bc2
fix(ir): fix sealing of blocks for loops
Entenwilli Jun 16, 2025
a521967
fix(semantic): additional return/type checking fixes
Entenwilli Jun 16, 2025
bc28279
fix(semantic): disallow decleration of variables in for updater
Entenwilli Jun 16, 2025
b1db801
fix(semantic): additional fixes for initalizers in for loops
Entenwilli Jun 16, 2025
75ed621
refactor: formatting and checks
Entenwilli Jun 16, 2025
dae5510
fix(ir): fix if block generation
Entenwilli Jun 16, 2025
92efca8
fix(ir/semantic): fix for loop checking order and fix break/continues
Entenwilli Jun 16, 2025
95837d2
fix(parser): mark expect methods as must use and fix resulting bugs
Entenwilli Jun 16, 2025
17b05a3
fix(semantic): more block scoping fixes
Entenwilli Jun 16, 2025
23d94cd
fix(ir): some more block order fixes ⚰️
Entenwilli Jun 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.s
*.o
tests
test.l2
output
152 changes: 152 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ edition = "2021"

[dependencies]
rand = "0.9.1"
tracing = { version = "0.1.41", features=["release_max_level_warn"]}
tracing-subscriber = "0.3.19"
3 changes: 3 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env fish
cargo build --release
nix run github:I-Al-Istannen/crow#client -- run-tests --test-dir tests/ --compiler-run ./run.sh --only-failing
23 changes: 23 additions & 0 deletions src/backend/aasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use super::regalloc::Register;

pub enum Instruction {
Mov(Box<dyn Register>, Box<dyn Register>),
Add(Box<dyn Register>, Box<dyn Register>),
Sub(Box<dyn Register>, Box<dyn Register>),
Idiv(Box<dyn Register>, Box<dyn Register>),
Imul(Box<dyn Register>, Box<dyn Register>),
Sall(Box<dyn Register>, Box<dyn Register>),
Sarl(Box<dyn Register>, Box<dyn Register>),
Jmp(String),
Cmp(Box<dyn Register>, Box<dyn Register>),
Test(Box<dyn Register>, Box<dyn Register>),
Jb(String),
Jbe(String),
Je(String),
Jne(String),
Jae(String),
Ja(String),
Cdq,
Leave,
Ret,
}
Loading